class 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));
        }
    }

}