@Test
public void testInitChannelWithTimeoutHandler() throws Exception {

    IpfixCollectorTimeoutHandler timeoutHandler = mock(IpfixCollectorTimeoutHandler.class);
    IpfixCollectorClientInitializer client = new IpfixCollectorClientInitializer(m_collectingService, m_clientConnectedCount) {
        @Override
        protected IpfixCollectorTimeoutHandler createTimeoutHandler() {
            return timeoutHandler;
        }
    };
    ChannelHandlerContext context = mock(ChannelHandlerContext.class);
    doAnswer(invocationOnMock -> {
        ChannelHandlerContext channelHandlerContext = (ChannelHandlerContext) invocationOnMock.getArguments()[0];
        channelHandlerContext.close();
        return null;
    }).when(timeoutHandler).readTimedOut(any());
    SocketChannel channel = createChannelWithMockTimeoutHandler(context);
    client.initChannel(channel);
    verify(context).close();
}