@Override
    public ByteBuf setBytes(int index, ByteBuf src, int srcIndex, int length) {
        throw new ReadOnlyBufferException();
    }
@Test
    public void testSetBytesWithChannel() {
        final ByteBuf buf = newBuffer(wrappedBuffer(new byte[8]));
        try {
            assertThrows(ReadOnlyBufferException.class, new Executable() {
                @Override
                public void execute() throws IOException {
                    buf.setBytes(0, new ScatteringByteChannel() {
                        @Override
                        public long read(ByteBuffer[] dsts, int offset, int length) {
                            return 0;
                        }

                        @Override
                        public long read(ByteBuffer[] dsts) {
                            return 0;
                        }

                        @Override
                        public int read(ByteBuffer dst) {
                            return 0;
                        }

                        @Override
                        public boolean isOpen() {
                            return true;
                        }

                        @Override
                        public void close() {
                        }
                    }, 4);
                }
            });
        } finally {
            buf.release();
        }
    }