private synchronized void maybeAwaitWakeup() {
        try {
            int remainingBlockingWakeups = numBlockingWakeups;
            if (remainingBlockingWakeups <= 0)
                return;

            TestUtils.waitForCondition(() -> {
                if (numBlockingWakeups == remainingBlockingWakeups)
                    MockClient.this.wait(500);
                return numBlockingWakeups < remainingBlockingWakeups;
            }, 5000, "Failed to receive expected wakeup");
        } catch (InterruptedException e) {
            throw new InterruptException(e);
        }
    }
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