@Test
public void testFireChannelRegistered() throws Exception {

    final CountDownLatch latch = new CountDownLatch(1);
    ChannelPipeline pipeline = new LocalChannel().pipeline();
    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();
                }
            });
        }
    });
    group.register(pipeline.channel());
    assertTrue(latch.await(2, TimeUnit.SECONDS));
}