@Test
public void ensureInitialRegistrationFiresActive() throws Throwable {

    EventLoop eventLoop = mock(EventLoop.class);
    // This allows us to have a single-threaded test
    when(eventLoop.inEventLoop()).thenReturn(true);
    TestChannel channel = new TestChannel();
    ChannelInboundHandler handler = mock(ChannelInboundHandler.class);
    channel.pipeline().addLast(handler);
    registerChannel(eventLoop, channel);
    verify(handler).handlerAdded(any(ChannelHandlerContext.class));
    verify(handler).channelRegistered(any(ChannelHandlerContext.class));
    verify(handler).channelActive(any(ChannelHandlerContext.class));
}