private void maybeThrowSslAuthenticationException() {
        if (handshakeException != null)
            throw handshakeException;
    }
SSL exceptions are propagated as authentication failures so that clients can avoid
retries and report the failure. If `flush` is true, exceptions are propagated after
any pending outgoing bytes are flushed to ensure that the peer is notified of the failure.
clients/src/main/java/org/apache/kafka/common/network/SslTransportLayer.java