@Test(expected = ReadOnlyBufferException.class)
public void testSetBytesWithInputStream() throws IOException {

    ByteBuf buf = newBuffer(wrappedBuffer(new byte[8]));
    try {
        buf.setBytes(0, new ByteArrayInputStream(new byte[4]), 4);
    } finally {
        buf.release();
    }
}