Proper way of disconnecting when client has no internet?

Hi, I have a xmpp server and I’m using smack for the client and everything works great! except when I want to disconnect because when the client has internet connection it successfully disconnect but if the user want to disconnect and It doesn’t have internet I don’t know how to properly disconnect because as soon as the internet comes back it is still connected.

Here is how I disconnect.

if ( this.mConnection.isConnected()) // it crashes without this 
                this.mConnection.disconnect();

How can you disconnect if you lose connectivity ?

Basically the socket is being forcefully closed with the server, so in a sense you are disconnected.

If it’s connected when the internet comes back you probably have resumption activated, try disabling that feature. Also you can control that with Android’s connectivity manager and you can disconnect after a connection loss correctly if that’s what you want.

Use XMPPTCPConnection.instantShutdown()

Hooo! that looks like the thing I need. By the way is there another source of documentation apart from this one http://download.igniterealtime.org/smack/docs/latest/documentation/

Because that one is too simple.

I fear the only more extensive documentation would be the javadoc docs from the source files.

Which is at http://download.igniterealtime.org/smack/docs/latest/javadoc/ FWIW