gnodet commented on code in PR #22981:
URL: https://github.com/apache/camel/pull/22981#discussion_r3194042496


##########
components/camel-as2/camel-as2-api/src/test/java/org/apache/camel/component/as2/api/AS2MessageTestBase.java:
##########
@@ -86,14 +84,13 @@ public class AS2MessageTestBase {
 
     protected static final String METHOD = "POST";
     protected static final String TARGET_HOST = "localhost";
-    @RegisterExtension
-    protected static AvailablePortFinder.Port TARGET_PORT = 
AvailablePortFinder.find();
+    protected static int TARGET_PORT;

Review Comment:
   _Claude Code on behalf of Guillaume Nodet_
   
   Good catch — renamed `TARGET_PORT` to `targetPort` since it's no longer a 
constant. Fixed in 7413a4a.



##########
components/camel-as2/camel-as2-api/src/test/java/org/apache/camel/component/as2/api/AS2MessageTestBase.java:
##########
@@ -86,14 +84,13 @@ public class AS2MessageTestBase {
 
     protected static final String METHOD = "POST";
     protected static final String TARGET_HOST = "localhost";
-    @RegisterExtension
-    protected static AvailablePortFinder.Port TARGET_PORT = 
AvailablePortFinder.find();
+    protected static int TARGET_PORT;
     protected static final Duration HTTP_SOCKET_TIMEOUT = 
Duration.ofSeconds(5);
     protected static final Duration HTTP_CONNECTION_TIMEOUT = 
Duration.ofSeconds(5);
     protected static final Integer HTTP_CONNECTION_POOL_SIZE = 5;
     protected static final Duration HTTP_CONNECTION_POOL_TTL = 
Duration.ofMinutes(15);
     protected static final Certificate[] VALIDATE_SIGNING_CERTIFICATE_CHAIN = 
null;
-    protected static final String RECIPIENT_DELIVERY_ADDRESS = 
"http://localhost:"; + TARGET_PORT.getPort() + "/handle-receipts";
+    protected static String RECIPIENT_DELIVERY_ADDRESS;

Review Comment:
   _Claude Code on behalf of Guillaume Nodet_
   
   Good catch — renamed `RECIPIENT_DELIVERY_ADDRESS` to 
`recipientDeliveryAddress` since it's no longer a constant. Fixed in 7413a4a.



##########
components/camel-as2/camel-as2-api/src/main/java/org/apache/camel/component/as2/api/AS2ServerConnection.java:
##########
@@ -639,6 +639,10 @@ public void registerConsumerConfiguration(String path, 
AS2ConsumerConfiguration
         consumerConfigurations.put(path, config);
     }
 
+    public int getLocalPort() {
+        return serversocket != null ? serversocket.getLocalPort() : -1;

Review Comment:
   _Claude Code on behalf of Guillaume Nodet_
   
   Returning `-1` is intentional — it follows the `ServerSocket.getLocalPort()` 
convention where `-1` means "not bound / closed". Returning `0` would be 
misleading since `0` means "pick an ephemeral port" in socket APIs, which could 
cause silent bugs if the value is accidentally passed to another `new 
ServerSocket(0)` or `bind()` call. The `-1` sentinel makes the error explicit.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to