@Override
    public boolean consumeBytes(Http2Stream stream, int numBytes) throws Http2Exception {
        assert ctx != null && ctx.executor().inEventLoop();
        checkPositiveOrZero(numBytes, "numBytes");
        if (numBytes == 0) {
            return false;
        }

        // Streams automatically consume all remaining bytes when they are closed, so just ignore
        // if already closed.
        if (stream != null && !isClosed(stream)) {
            if (stream.id() == CONNECTION_STREAM_ID) {
                throw new UnsupportedOperationException("Returning bytes for the connection window is not supported");
            }

            return consumeAllBytes(state(stream), numBytes);
        }
        return false;
    }
@Test
    public void consumeBytesForNegativeNumBytesShouldFail() throws Http2Exception {
        assertThrows(IllegalArgumentException.class, new Executable() {
            @Override
            public void execute() throws Throwable {
                controller.consumeBytes(connection.stream(STREAM_ID), -1);
            }
        });
    }