    @Test
    public void testWriteChunksToStream() throws IOException {

        final byte[] data = new byte[256];
        int counter = 0;
        for (int i = 0; i < data.length; i++) {
            data[i] = (byte) counter++;
        }

        byte[] header = new byte[9];
        // Test when chunk size % data.length == 0
        testWithGivenChunkSize(data, header, 16);

        // test when chunk size % data.length != 0
        testWithGivenChunkSize(data, header, 10);

        // test with an odd number...
        testWithGivenChunkSize(data, header, 13);
    }