docs: public SASLMechanism authenticate(String username, String password, EntityBareJid authzid, SSLSession sslSession)
                      throws XMPPErrorException, SASLErrorException, IOException,
                      InterruptedException, SmackSaslException, NotConnectedException, NoResponseException {
          currentMechanism = selectMechanism(authzid);
          final CallbackHandler callbackHandler = configuration.getCallbackHandler();
          final String host = connection.getHost();
          final DomainBareJid xmppServiceDomain = connection.getXMPPServiceDomain();
  
          synchronized (this) {
              if (callbackHandler != null) {
                  currentMechanism.authenticate(host, xmppServiceDomain, callbackHandler, authzid, sslSession);
              }
              else {
                  currentMechanism.authenticate(username, host, xmppServiceDomain, password, authzid, sslSession);
              }
              final long deadline = System.currentTimeMillis() + connection.getReplyTimeout();
              while (!authenticationSuccessful && saslException == null) {
                  final long now = System.currentTimeMillis();
                  if (now >= deadline) break;
                  // Wait until SASL negotiation finishes
                  wait(deadline - now);
              }
          }
  
          if (saslException != null) {
              if (saslException instanceof SmackSaslException) {
                  throw (SmackSaslException) saslException;
              } else if (saslException instanceof SASLErrorException) {
                  throw (SASLErrorException) saslException;
              } else if (saslException instanceof NotConnectedException) {
                  throw (NotConnectedException) saslException;
              } else {
                  throw new IllegalStateException("Unexpected exception type" , saslException);
              }
          }
  
          if (!authenticationSuccessful) {
              throw NoResponseException.newWith(connection, "successful SASL authentication");
          }
  
          return currentMechanism;
      }