diff --git a/src/test/java/io/github/hectorvent/floci/services/iot/IotMqttBrokerServiceTest.java b/src/test/java/io/github/hectorvent/floci/services/iot/IotMqttBrokerServiceTest.java index 3ca77e0d25..e94d367c63 100644 --- a/src/test/java/io/github/hectorvent/floci/services/iot/IotMqttBrokerServiceTest.java +++ b/src/test/java/io/github/hectorvent/floci/services/iot/IotMqttBrokerServiceTest.java @@ -668,11 +668,14 @@ class IotMqttBrokerServiceTest { void aFailedRestartKeepsRulesOff() throws Exception { broker.startIfEnabled(); broker.stop(); + awaitClosed(plainPort); + awaitClosed(tlsPort); try (ServerSocket blocker = new ServerSocket()) { blocker.bind(new InetSocketAddress("127.0.0.1", tlsPort)); assertThrows(IllegalStateException.class, broker::startIfEnabled); assertFalse(rulesRun(), "a failed restart leaves rules off"); + awaitClosed(plainPort); } broker.startIfEnabled();