@Test
public void writeBytes() throws IOException {

    test(new CB() {
        public void run(boolean close) throws IOException {
            BAOS baos = new BAOS();
            StreamUtil.writeBytes(bytes, baos, close);
            assertArrayEquals(bytes, baos.toByteArray());
            baos.assertClosed(close);
            baos = new BAOS();
            StreamUtil.writeBytes(new ByteArray(bytes), baos, close);
            assertArrayEquals(bytes, baos.toByteArray());
            baos.assertClosed(close);
        }
    });
}