From d2940741f83d67dfd26fbce605aea699a645f7f8 Mon Sep 17 00:00:00 2001 From: andrea Date: Mon, 27 Aug 2012 11:35:42 +0200 Subject: [PATCH] Fixed a TU to wait an asych publish event --- .../org/dna/mqtt/moquette/server/ServerIntegrationTest.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/parser/src/test/java/org/dna/mqtt/moquette/server/ServerIntegrationTest.java b/parser/src/test/java/org/dna/mqtt/moquette/server/ServerIntegrationTest.java index e26e8373..49020886 100644 --- a/parser/src/test/java/org/dna/mqtt/moquette/server/ServerIntegrationTest.java +++ b/parser/src/test/java/org/dna/mqtt/moquette/server/ServerIntegrationTest.java @@ -163,7 +163,8 @@ public class ServerIntegrationTest { @Test - public void testCleanSession_maintainClientSubscriptions_withServerRestart() throws IOException { + public void testCleanSession_maintainClientSubscriptions_withServerRestart() throws IOException, InterruptedException { + final CountDownLatch barrier = new CountDownLatch(1); Client client = new Client("localhost", Server.PORT, "CLID_123"); client.connect(false); //without session cleanup @@ -185,6 +186,7 @@ public class ServerIntegrationTest { public void published(String topic, byte[] message) { received = true; + barrier.countDown(); } }); client.connect(false); @@ -192,6 +194,7 @@ public class ServerIntegrationTest { client.close(); //Verify + barrier.await(1, TimeUnit.SECONDS); assertTrue(received); //TearDown