@Test void initChannel() throws Exception { Mockito .when(socketChannel.pipeline()) .thenReturn(channelPipeline); Mockito .when(channelPipeline.addLast(any())) .thenReturn(channelPipeline); Mockito .when(channelPipeline.first()) .thenReturn(new ByteArrayDecoder()); Mockito .when(channelPipeline.last()) .thenReturn(new DssTcpHandler()); final DssTcpChannelInitializer dssTcpChannelInitializer = Mockito.mock(DssTcpChannelInitializer.class); dssTcpChannelInitializer.initChannel(socketChannel); final ChannelPipeline p = socketChannel.pipeline(); assertEquals(ByteArrayDecoder.class, p.first().getClass()); assertEquals(DssTcpHandler.class, p.last().getClass()); }
@Override protected void initChannel(SocketChannel ch) throws Exception { logger.info("Try to initChannel"); final ChannelPipeline p = ch.pipeline(); p.addLast(new DssTcpHandler()); }
DssTcpChannelInitializer extends ChannelInitializer<SocketChannel> { @Override protected void initChannel(SocketChannel ch) throws Exception { logger.info("Try to initChannel"); final ChannelPipeline p = ch.pipeline(); p.addLast(new DssTcpHandler()); } }
DssTcpChannelInitializer extends ChannelInitializer<SocketChannel> { @Override protected void initChannel(SocketChannel ch) throws Exception { logger.info("Try to initChannel"); final ChannelPipeline p = ch.pipeline(); p.addLast(new DssTcpHandler()); }  }
DssTcpChannelInitializer extends ChannelInitializer<SocketChannel> { @Override protected void initChannel(SocketChannel ch) throws Exception { logger.info("Try to initChannel"); final ChannelPipeline p = ch.pipeline(); p.addLast(new DssTcpHandler()); }   }
DssTcpChannelInitializer extends ChannelInitializer<SocketChannel> { @Override protected void initChannel(SocketChannel ch) throws Exception { logger.info("Try to initChannel"); final ChannelPipeline p = ch.pipeline(); p.addLast(new DssTcpHandler()); }    }