PacketCodec extends ByteToMessageCodec<DatabasePacket> { @SuppressWarnings("unchecked") @Override protected void encode(final ChannelHandlerContext context, final DatabasePacket message, final ByteBuf out) { databasePacketCodecEngine.encode(context, message, out); if (log.isDebugEnabled()) { log.debug("Write to client {} : \n {}", context.channel().id().asShortText(), ByteBufUtil.prettyHexDump(out)); } }    }
@SuppressWarnings("unchecked") @Test public void assertEncode() { DatabasePacket databasePacket = mock(DatabasePacket.class); packetCodec.encode(context, databasePacket, byteBuf); verify(databasePacketCodecEngine).encode(context, databasePacket, byteBuf); }