diff --git a/pulsar-broker/src/test/java/org/apache/pulsar/client/impl/BrokerClientIntegrationTest.java b/pulsar-broker/src/test/java/org/apache/pulsar/client/impl/BrokerClientIntegrationTest.java index b7ca39cba13814a0c7107ee23d07d34a63d2016d..9afbfa4fd64fa3aa0ad026ae8cd99467038f13f9 100644 --- a/pulsar-broker/src/test/java/org/apache/pulsar/client/impl/BrokerClientIntegrationTest.java +++ b/pulsar-broker/src/test/java/org/apache/pulsar/client/impl/BrokerClientIntegrationTest.java @@ -256,7 +256,15 @@ public class BrokerClientIntegrationTest extends ProducerConsumerBase { // [1] OwnershipCache should not contain any more namespaces OwnershipCache ownershipCache = pulsar.getNamespaceService().getOwnershipCache(); assertTrue(ownershipCache.getOwnedBundles().keySet().isEmpty()); - + // Strategical retry + for (int i = 0; i < 5; i++) { + if (producer1.getClientCnx() != null || consumer1.getClientCnx() != null + || producer2.getClientCnx() != null) { + Thread.sleep(100); + } else { + break; + } + } // [2] All clients must be disconnected and in connecting state // producer1 must not be able to connect again assertTrue(producer1.getClientCnx() == null);