MTSPacketToPESPacketDecoder extends MessageToMessageDecoder<MTSPacket> { @Override protected void decode(ChannelHandlerContext ctx, MTSPacket mtsPacket, List<Object> outputList) throws Exception { notNull(ctx, "ctx must be non-null"); notNull(mtsPacket, "mtsPacket must be non-null"); notNull(outputList, "outputList must be non-null"); mpegTsDecoder.read(mtsPacket, outputList::add); } MTSPacketToPESPacketDecoder(MpegTsDecoder mpegTsDecoder);  MTSPacketToPESPacketDecoder();   }
@Test public void testDecode() throws Exception { MpegTsDecoder mpegTsDecoder = mock(MpegTsDecoder.class); MTSPacketToPESPacketDecoder decoder = new MTSPacketToPESPacketDecoder(mpegTsDecoder); MTSPacket mtsPacket = mock(MTSPacket.class); EmbeddedChannel channel = new EmbeddedChannel(decoder); channel.writeInbound(mtsPacket); NettyUtility.read(channel); verify(mpegTsDecoder).read(eq(mtsPacket), anyObject()); }