/** * Performs ANONYMOUS SASL authentication. If SASL authentication was successful * then resource binding and session establishment will be performed. This method will return * the full JID provided by the server while binding a resource to the connection.<p> * * The server will assign a full JID with a randomly generated resource and possibly with * no username. * * @throws SASLErrorException * @throws XMPPErrorException if an error occures while authenticating. * @throws SmackException if there was no response from the server. */ public void authenticateAnonymously() throws SASLErrorException, SmackException, XMPPErrorException { currentMechanism = (new SASLAnonymous()).instanceForAuthentication(connection); // Wait until SASL negotiation finishes synchronized (this) { currentMechanism.authenticate(null, null, null, ""); try { wait(connection.getPacketReplyTimeout()); } catch (InterruptedException e) { // Ignore } } maybeThrowException(); if (!authenticationSuccessful) { throw NoResponseException.newWith(connection); } }