boolean ready(long now) {
            switch (state) {
                case CONNECTED:
                    return notThrottled(now);

                case CONNECTING:
                    if (isReadyDelayed(now))
                        return false;
                    state = State.CONNECTED;
                    return ready(now);

                case DISCONNECTED:
                    if (isBackingOff(now)) {
                        return false;
                    } else if (isUnreachable(now)) {
                        backingOffUntilMs = now + 100;
                        return false;
                    }

                    state = State.CONNECTING;
                    return ready(now);

                default:
                    throw new IllegalArgumentException("Invalid state: " + state);
            }
        }
This is a dumbed down version of {@link MetadataUpdater} which is used to facilitate
metadata tracking primarily in order to serve {@link KafkaClient#leastLoadedNode(long)}
and bookkeeping through {@link Metadata}. The extensibility allows AdminClient, which does
not rely on {@link Metadata} to do its own thing.
clients/src/test/java/org/apache/kafka/clients/MockClient.java