@Override
    protected void encode(ChannelHandlerContext ctx, byte[] msg, List<Object> out) throws Exception {
        out.add(Unpooled.wrappedBuffer(msg));
    }
@Test
    public void testEncode() {
        byte[] b = new byte[2048];
        new Random().nextBytes(b);
        ch.writeOutbound(b);
        ByteBuf encoded = ch.readOutbound();
        assertThat(encoded, is(wrappedBuffer(b)));
        encoded.release();
    }