public static ChannelBuffer wrappedBuffer(byte[] array, int offset, int length) {
        if (array == null) {
            throw new NullPointerException("array == null");
        }
        byte[] dest = new byte[length];
        System.arraycopy(array, offset, dest, 0, length);
        return wrappedBuffer(dest);
    }
@Test
    void testWrappedBuffer() {
        byte[] bytes = new byte[16];
        ChannelBuffer channelBuffer = ChannelBuffers.wrappedBuffer(bytes, 0, 15);
        Assertions.assertTrue(channelBuffer instanceof HeapChannelBuffer);
        Assertions.assertEquals(channelBuffer.capacity(), 15);

        channelBuffer = ChannelBuffers.wrappedBuffer(new byte[] {});
        Assertions.assertEquals(channelBuffer, EMPTY_BUFFER);

        ByteBuffer byteBuffer = ByteBuffer.allocate(16);
        channelBuffer = ChannelBuffers.wrappedBuffer(byteBuffer);
        Assertions.assertTrue(channelBuffer instanceof HeapChannelBuffer);

        byteBuffer = ByteBuffer.allocateDirect(16);
        channelBuffer = ChannelBuffers.wrappedBuffer(byteBuffer);
        Assertions.assertTrue(channelBuffer instanceof ByteBufferBackedChannelBuffer);

        byteBuffer.position(byteBuffer.limit());
        channelBuffer = ChannelBuffers.wrappedBuffer(byteBuffer);
        Assertions.assertEquals(channelBuffer, EMPTY_BUFFER);
    }