From b98959be6ce1a7ed661648a23383cee76c84617b Mon Sep 17 00:00:00 2001 From: Norman Maurer Date: Sun, 22 May 2016 19:33:48 +0200 Subject: [PATCH] Fix flacky test which was missed when commit 8fe3c83e4ca9a64c03f5adcb9f056d9e9440a389 --- .../java/io/netty/channel/DefaultChannelPipelineTest.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/transport/src/test/java/io/netty/channel/DefaultChannelPipelineTest.java b/transport/src/test/java/io/netty/channel/DefaultChannelPipelineTest.java index 383eae9e7e..dc0431be73 100644 --- a/transport/src/test/java/io/netty/channel/DefaultChannelPipelineTest.java +++ b/transport/src/test/java/io/netty/channel/DefaultChannelPipelineTest.java @@ -756,9 +756,10 @@ public class DefaultChannelPipelineTest { } @Test(timeout = 3000) - public void testHandlerAddedThrowsAndRemovedThrowsException() { + public void testHandlerAddedThrowsAndRemovedThrowsException() throws InterruptedException { final EventExecutorGroup group1 = new DefaultEventExecutorGroup(1); try { + final CountDownLatch latch = new CountDownLatch(1); final Promise promise = group1.next().newPromise(); final Exception exceptionAdded = new RuntimeException(); final Exception exceptionRemoved = new RuntimeException(); @@ -772,11 +773,13 @@ public class DefaultChannelPipelineTest { @Override public void handlerRemoved(ChannelHandlerContext ctx) throws Exception { + latch.countDown(); throw exceptionRemoved; } }); pipeline.addLast(group1, new CheckExceptionHandler(exceptionAdded, promise)); group.register(pipeline.channel()).syncUninterruptibly(); + latch.await(); assertNull(pipeline.context(handlerName)); promise.syncUninterruptibly(); } finally {