### Question:
ByteArrayDecoder extends MessageToMessageDecoder<ByteBuf> { @Override protected void decode(ChannelHandlerContext ctx, ByteBuf msg, List<Object> out) throws Exception { out.add(ByteBufUtil.getBytes(msg)); }    }### Answer:
@Test public void testDecode() { byte[] b = new byte[2048]; new Random().nextBytes(b); ch.writeInbound(wrappedBuffer(b)); assertThat((byte[]) ch.readInbound(), is(b)); }