ByteValue implements ByteReadable { @Override public ByteBuf getByteBuf() { return Unpooled.wrappedBuffer(value); } protected  ByteValue(byte... value); protected  ByteValue(ByteBuf byteBuf); static void checkUnsignedBounds(long value, int numberOfBytes); static void checkUnsignedBounds(BigInteger value, int numberOfBytes); @Override byte[] getBytes(); @Override ByteBuf getByteBuf(); @Override long getCalculatedLength(); static ByteValue of(byte... values); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString();  }
@Test public void getByteBuf() { byte[] correct = {(byte) 0x1, (byte) 0x2, (byte) 0x3, (byte) 0x4}; ByteBuf data = byteValue.getByteBuf(); assertThat(data.readableBytes(), is(4)); assertThat(data.readByte(), is((byte) 0x1)); assertThat(data.readByte(), is((byte) 0x2)); assertThat(data.readByte(), is((byte) 0x3)); assertThat(data.readByte(), is((byte) 0x4)); assertThat(copyOfRange(data.array(), 0, 4), is(correct)); }