public Set<BrokerServer> brokersInState(Predicate<BrokerState> desiredState) {
        return cluster.brokers().values().stream()
                .filter(b -> desiredState.test(b.brokerState()))
                .collect(Collectors.toSet());
    }
Get the brokers whose state match the given predicate.

@return the set of {@link BrokerServer} instances with states that match the predicate;
        never null but possibly empty
connect/runtime/src/test/java/org/apache/kafka/connect/util/clusters/EmbeddedKafkaCluster.java