@Override
    public void waitObject(Object obj, Supplier<Boolean> condition, long deadlineMs) throws InterruptedException {
        Listener listener = () -> {
            synchronized (obj) {
                obj.notify();
            }
        };
        listeners.add(listener);
        try {
            synchronized (obj) {
                while (milliseconds() < deadlineMs && !condition.get()) {
                    obj.wait();
                }
                if (!condition.get())
                    throw new TimeoutException("Condition not satisfied before deadline");
            }
        } finally {
            listeners.remove(listener);
        }
    }
Listeners which are waiting for time changes.
clients/src/test/java/org/apache/kafka/common/utils/MockTime.java