public boolean isPreparingConnection(String id) {
        NodeConnectionState state = nodeState.get(id);
        return state != null &&
                (state.state == ConnectionState.CONNECTING || state.state == ConnectionState.CHECKING_API_VERSIONS);
    }
Check whether a connection is either being established or awaiting API version information.
@param id The id of the node to check
@return true if the node is either connecting or has connected and is awaiting API versions, false otherwise
clients/src/main/java/org/apache/kafka/clients/ClusterConnectionStates.java