public static void waitForBlock() throws InterruptedException, TimeoutException {
            Timer timer = Time.SYSTEM.timer(CONNECTOR_BLOCK_TIMEOUT_MS);

            CountDownLatch awaitBlockLatch;
            synchronized (Block.class) {
                while (Block.awaitBlockLatch == null) {
                    timer.update();
                    if (timer.isExpired()) {
                        throw new TimeoutException("Timed out waiting for connector to block.");
                    }
                    Block.class.wait(timer.remainingMs());
                }
                awaitBlockLatch = Block.awaitBlockLatch;
            }

            log.debug("Waiting for connector to block");
            timer.update();
            if (!awaitBlockLatch.await(timer.remainingMs(), TimeUnit.MILLISECONDS)) {
                throw new TimeoutException("Timed out waiting for connector to block.");
            }
            log.debug("Connector should now be blocked");
        }
{@link CountDownLatch#await() Wait} for the connector/task to reach the point in its lifecycle where
it will block.
connect/runtime/src/test/java/org/apache/kafka/connect/integration/BlockingConnectorTest.java