Payload2TcpProtocol extends MessageToMessageCodec<ByteBuf, ByteBuf> { @Override protected void encode(ChannelHandlerContext channelHandlerContext, ByteBuf amsPacket, List<Object> out) { LOGGER.trace("(<--OUT): {}, {}, {}", channelHandlerContext, amsPacket, out); out.add(AmsTCPPacket.of(UserData.of(amsPacket)).getByteBuf()); }    }
@Test public void encode() throws Exception { ArrayList<Object> out = new ArrayList<>(); SUT.encode(channelHandlerContextMock, Unpooled.wrappedBuffer(amsPacketBytes), out); assertEquals(1, out.size()); assertThat(out, hasSize(1)); }