Fix flaky ChannelInitializerTest.testChannelInitializerEventExecutor() (#8738)

Motivation:

testChannelInitializerEventExecutor() did sometimes fail as we sometimes miss to count down the latch. This can happen when we remove the handler from the pipeline before channelUnregistered(...) was called for it.

Modifications:

Countdown the latch in handlerRemoved(...).

Result:

Fix flaky test.
This commit is contained in:
Norman Maurer 2019-01-21 09:01:04 +01:00
parent 8bcea35d2e
commit d870199c4e

View File

@ -338,7 +338,7 @@ public class ChannelInitializerTest {
}
@Override
public void channelUnregistered(ChannelHandlerContext ctx) {
public void handlerRemoved(ChannelHandlerContext ctx) {
latch.countDown();
}
});
@ -372,6 +372,7 @@ public class ChannelInitializerTest {
client.closeFuture().sync();
server.closeFuture().sync();
// Wait until the handler is removed from the pipeline and so no more events are handled by it.
latch.await();
assertEquals(1, invokeCount.get());