Fix flacky test which was missed when commit 8fe3c83e4c
This commit is contained in:
parent
06d76eeea4
commit
26a175cd94
@ -769,9 +769,10 @@ public class DefaultChannelPipelineTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test(timeout = 3000)
|
@Test(timeout = 3000)
|
||||||
public void testHandlerAddedThrowsAndRemovedThrowsException() {
|
public void testHandlerAddedThrowsAndRemovedThrowsException() throws InterruptedException {
|
||||||
final EventExecutorGroup group1 = new DefaultEventExecutorGroup(1);
|
final EventExecutorGroup group1 = new DefaultEventExecutorGroup(1);
|
||||||
try {
|
try {
|
||||||
|
final CountDownLatch latch = new CountDownLatch(1);
|
||||||
final Promise<Void> promise = group1.next().newPromise();
|
final Promise<Void> promise = group1.next().newPromise();
|
||||||
final Exception exceptionAdded = new RuntimeException();
|
final Exception exceptionAdded = new RuntimeException();
|
||||||
final Exception exceptionRemoved = new RuntimeException();
|
final Exception exceptionRemoved = new RuntimeException();
|
||||||
@ -785,11 +786,13 @@ public class DefaultChannelPipelineTest {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void handlerRemoved(ChannelHandlerContext ctx) throws Exception {
|
public void handlerRemoved(ChannelHandlerContext ctx) throws Exception {
|
||||||
|
latch.countDown();
|
||||||
throw exceptionRemoved;
|
throw exceptionRemoved;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
pipeline.addLast(group1, new CheckExceptionHandler(exceptionAdded, promise));
|
pipeline.addLast(group1, new CheckExceptionHandler(exceptionAdded, promise));
|
||||||
group.register(pipeline.channel()).syncUninterruptibly();
|
group.register(pipeline.channel()).syncUninterruptibly();
|
||||||
|
latch.await();
|
||||||
assertNull(pipeline.context(handlerName));
|
assertNull(pipeline.context(handlerName));
|
||||||
promise.syncUninterruptibly();
|
promise.syncUninterruptibly();
|
||||||
} finally {
|
} finally {
|
||||||
|
Loading…
Reference in New Issue
Block a user