Add testcase to show channelRegistered is called
This commit is contained in:
parent
51fa795819
commit
9ca20b73d3
@ -188,6 +188,26 @@ public class DefaultChannelPipelineTest {
|
|||||||
verifyContextNumber(pipeline, HANDLER_ARRAY_LEN * 2);
|
verifyContextNumber(pipeline, HANDLER_ARRAY_LEN * 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testFireChannelRegistered() throws Exception {
|
||||||
|
ChannelPipeline pipeline = new LocalChannel().pipeline();
|
||||||
|
group.register(pipeline.channel());
|
||||||
|
final CountDownLatch latch = new CountDownLatch(1);
|
||||||
|
pipeline.addLast(new ChannelInitializer<Channel>() {
|
||||||
|
@Override
|
||||||
|
protected void initChannel(Channel ch) throws Exception {
|
||||||
|
ch.pipeline().addLast(new ChannelInboundHandlerAdapter() {
|
||||||
|
@Override
|
||||||
|
public void channelRegistered(ChannelHandlerContext ctx) throws Exception {
|
||||||
|
latch.countDown();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
pipeline.fireChannelRegistered();
|
||||||
|
assertTrue(latch.await(2, TimeUnit.SECONDS));
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testPipelineOperation() {
|
public void testPipelineOperation() {
|
||||||
ChannelPipeline pipeline = new LocalChannel().pipeline();
|
ChannelPipeline pipeline = new LocalChannel().pipeline();
|
||||||
|
Loading…
Reference in New Issue
Block a user