Skip to content

Commit 3f99424

Browse files
committed
Fix connection race condition in MQTT test
It looks like `isConnected` flag in the MQTT Client is reset when we already have subscribed
1 parent fe9b59e commit 3f99424

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

spring-integration-mqtt/src/test/java/org/springframework/integration/mqtt/ResubscribeAfterAutomaticReconnectTests.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
4141

4242
import static org.assertj.core.api.Assertions.assertThat;
43+
import static org.awaitility.Awaitility.await;
4344

4445
/**
4546
* @author Artem Bilan
@@ -81,7 +82,7 @@ void messageReceivedAfterResubscriptionOnLostConnection() throws InterruptedExce
8182

8283
assertThat(this.config.subscribeSecondLatch.await(10, TimeUnit.SECONDS)).isTrue();
8384

84-
this.mqttOutFlowInput.send(testMessage);
85+
await().untilAsserted(() -> this.mqttOutFlowInput.send(testMessage));
8586
assertThat(this.fromMqttChannel.receive(10_000)).isNotNull();
8687

8788
// Re-subscription on channel adapter restart with cleanStart

0 commit comments

Comments
 (0)