davsclaus commented on code in PR #28244:
URL: https://github.com/apache/camel/pull/28244#discussion_r4347319079


##########
components/camel-smpp/src/test/java/org/apache/camel/component/smpp/integration/SmppTRXProducerIT.java:
##########
@@ -62,12 +64,32 @@ class SmppTRXProducerIT extends CamelTestSupport {
 
     @BeforeAll
     public static void runSMPPServerSimulator() {
-        SMPP_SERVER_SIMULATOR.start();
+        smppServerSimulator = new Thread(() -> {
+            System.setProperty("jsmpp.simulator.port", "" + PORT.getPort());
+            SMPPServerSimulator.main(null);
+        });
+        smppServerSimulator.setDaemon(true);
+        smppServerSimulator.start();
     }
 
     @AfterAll
     public static void stopSMPPServerSimulator() {
-        SMPP_SERVER_SIMULATOR.interrupt();
+        if (smppServerSimulator != null) {
+            smppServerSimulator.interrupt();
+        }
+    }
+
+    @Override
+    protected void doPreSetup() throws Exception {
+        // Wait for the SMPP server to be ready before the Camel context 
starts,
+        // otherwise the route startup connection attempt fails with 
"Connection refused".
+        await().atMost(30, TimeUnit.SECONDS).until(() -> {

Review Comment:
   Blocking (point 1). The probe opens a connection and closes it without a 
bind. `SMPPServerSimulator.run()` then sits in `future.get()` on a 
`WaitBindTask` with a 30 s timeout before it calls `accept()` again. The 
route's bind waits behind it, which is why this IT now takes 91 s in CI. A 
probe that sends a bind the simulator rejects right away (for example 
`BIND_TX`, since it only accepts transceiver) would show readiness without 
blocking the loop.



##########
components/camel-smpp/src/test/java/org/apache/camel/component/smpp/integration/SmppTRXProducerIT.java:
##########
@@ -62,12 +64,32 @@ class SmppTRXProducerIT extends CamelTestSupport {
 
     @BeforeAll
     public static void runSMPPServerSimulator() {
-        SMPP_SERVER_SIMULATOR.start();
+        smppServerSimulator = new Thread(() -> {
+            System.setProperty("jsmpp.simulator.port", "" + PORT.getPort());
+            SMPPServerSimulator.main(null);
+        });
+        smppServerSimulator.setDaemon(true);
+        smppServerSimulator.start();
     }
 
     @AfterAll
     public static void stopSMPPServerSimulator() {
-        SMPP_SERVER_SIMULATOR.interrupt();
+        if (smppServerSimulator != null) {
+            smppServerSimulator.interrupt();
+        }
+    }
+
+    @Override
+    protected void doPreSetup() throws Exception {

Review Comment:
   Not blocking (point 2). This runs before every test, but the server is 
class-scoped. Waiting once in `@BeforeAll`, after `start()`, is enough, and it 
avoids the deprecated `doPreSetup()`.



-- 
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