public void disconnect ( ) { Presence unavailablePresence = null ; if ( isAuthenticated ( ) ) { unavailablePresence = new Presence ( Presence . Type . unavailable ) ; } try { disconnect ( unavailablePresence ) ; } catch ( NotConnectedException e ) { LOGGER . log ( Level . FINEST , "Connection is already disconnected" , e ) ; } }
Closes the connection by setting presence to unavailable then closing the connection to the XMPP server . The XMPPConnection can still be used for connecting to the server again .