Fix flacky test which was missed when commit 8fe3c83e4ca9a64c03f5adcb9f056d9e9440a389

This commit is contained in:
Norman Maurer 2016-05-22 19:33:48 +02:00
parent 9f7e7ad356
commit b98959be6c

View File

@ -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<Void> 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 {