    @Test
    public void testToByteBufferArray() {


        final byte[] bytes = new byte[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };

        final List<Buffer> bufferList = new ArrayList<>();
        for (byte b : bytes) {
            final Buffer buffer = mm.allocate(1);
            buffer.put(0, b);
            bufferList.add(buffer);
        }

        final Buffer[] buffers = bufferList.toArray(new Buffer[bufferList.size()]);
        final CompositeBuffer composite = CompositeBuffer.newBuffer(mm, buffers);

        for (int i = 0; i < bytes.length; i++) {
            for (int j = i; j < bytes.length; j++) {
                final ByteBufferArray bbArray = composite.toByteBufferArray(i, j);

                int bytesChecked = 0;
                final ByteBuffer[] bbs = bbArray.getArray();
                for (int k = 0; k < bbArray.size(); k++) {
                    final ByteBuffer bb = bbs[k];

                    while (bb.hasRemaining()) {
                        final byte got = bb.get();
                        assertEquals("Testcase [pos=" + i + " lim=" + j + " bytenumber=" + bytesChecked + "]", bytes[i + bytesChecked], got);
                        bytesChecked++;
                    }
                }

                assertEquals(j - i, bytesChecked);
                bbArray.restore();
            }
        }
    }