Ads2PayloadProtocol extends MessageToMessageCodec<ByteBuf, AmsPacket> { @Override protected void encode(ChannelHandlerContext channelHandlerContext, AmsPacket amsPacket, List<Object> out) { LOGGER.trace("(<--OUT): {}, {}, {}", channelHandlerContext, amsPacket, out); Invoke invokeId = amsPacket.getAmsHeader().getInvokeId(); if (invokeId != Invoke.NONE) { requests.put(invokeId, amsPacket); } out.add(amsPacket.getByteBuf()); } Ads2PayloadProtocol(); void reset();  }
@Test public void encode() throws Exception { ArrayList<Object> out = new ArrayList<>(); SUT.encode(null, amsPacket, out); assertEquals(1, out.size()); assertThat(out, hasSize(1)); }