public static void maybeThrowAuthFailure(KafkaClient client, Node node) {
        AuthenticationException exception = client.authenticationException(node);
        if (exception != null)
            throw exception;
    }
Check for an authentication error on a given node and raise the exception if there is one.
clients/src/main/java/org/apache/kafka/clients/NetworkClientUtils.java