@Override
    public ByteBuf readBytes(int length) {
        checkReadableBytes(length);
        if (length == 0) {
            return Unpooled.EMPTY_BUFFER;
        }

        ByteBuf buf = alloc().buffer(length, maxCapacity);
        buf.writeBytes(this, readerIndex, length);
        readerIndex += length;
        return buf;
    }
@Test
    public void testReadBytesAfterRelease4() {
        final ByteBuf buffer = buffer(8);
        try {
            assertThrows(IllegalReferenceCountException.class, new Executable() {
                @Override
                public void execute() {
                    releasedBuffer().readBytes(buffer, 0, 1);
                }
            });
        } finally {
            buffer.release();
        }
    }