public void respond(RequestMatcher matcher, AbstractResponse response) {
        ClientRequest nextRequest = requests.peek();
        if (nextRequest == null)
            throw new IllegalStateException("No current requests queued");

        AbstractRequest request = nextRequest.requestBuilder().build();
        if (!matcher.matches(request))
            throw new IllegalStateException("Request matcher did not match next-in-line request " + request);

        respond(response);
    }
Simulate a blocking poll in order to test wakeup behavior.

@param numBlockingWakeups The number of polls which will block until woken up
clients/src/test/java/org/apache/kafka/clients/MockClient.java