ByteArrayWrapperByteBuf extends AbstractByteBuf { @Override public byte[] array() { return data; } ByteArrayWrapperByteBuf(byte[] data); @Override byte[] array(); @Override int readableBytes(); @Override boolean release();  }
@Test public void array() { AbstractByteBuf byteBuf = new ByteArrayWrapperByteBuf(null); Assert.assertNull(byteBuf.array()); byte[] bs = new byte[] { 1, 2, 3 }; byteBuf = new ByteArrayWrapperByteBuf(bs); Assert.assertNotNull(byteBuf.array()); Assert.assertTrue(byteBuf.array().length == 3); Assert.assertTrue(byteBuf.readableBytes() == 3); Assert.assertTrue(byteBuf.release()); }