From ece5d81e3d835367927db9adec8f7ff5b654eab0 Mon Sep 17 00:00:00 2001 From: Clebert Suconic Date: Tue, 9 Feb 2016 18:59:14 -0500 Subject: [PATCH] ARTEMIS-388 fixing testsuite (the socket.bind not being closed was preventing other tests to run successfully) --- .../server/ActivationFailureListenerTest.java | 27 +++++++++++-------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/ActivationFailureListenerTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/ActivationFailureListenerTest.java index 6732b7ac5d..a43e2c8c7a 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/ActivationFailureListenerTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/ActivationFailureListenerTest.java @@ -37,16 +37,21 @@ public class ActivationFailureListenerTest extends ActiveMQTestBase { @Test public void simpleTest() throws Exception { Socket s = new Socket(); - s.bind(new InetSocketAddress("127.0.0.1", 61616)); - server = createServer(false, createDefaultNettyConfig()); - final CountDownLatch latch = new CountDownLatch(1); - server.registerActivationFailureListener(new ActivationFailureListener() { - @Override - public void activationFailed(Exception exception) { - latch.countDown(); - } - }); - server.start(); - assertTrue(latch.await(3000, TimeUnit.MILLISECONDS)); + try { + s.bind(new InetSocketAddress("127.0.0.1", 61616)); + server = createServer(false, createDefaultNettyConfig()); + final CountDownLatch latch = new CountDownLatch(1); + server.registerActivationFailureListener(new ActivationFailureListener() { + @Override + public void activationFailed(Exception exception) { + latch.countDown(); + } + }); + server.start(); + assertTrue(latch.await(3000, TimeUnit.MILLISECONDS)); + } + finally { + s.close(); + } } }