Can you explain this connection behavior?

I need an explanation as to why I might be seeing this behavior, it doesn’t make any sense to me at all:

  • XMPP server is off, intentionally

  • Launch a client that’s using the Smack library, have it loop while (!xmppConn.isAuthenticated()) until a connection is established. Can’t use while (!xmppConn.isConnected()) because that returns true even though the server is offline, which is head-scratcher #1. xmppConn.connect() also throws no exception when the server is offline, which doesn’t seem right.

  • Turn the XMPP server on

  • while (!xmppConn.isAuthenticate()) loop exits on client because everything is fine now, connection and login successful.

  • Turn the XMPP server off again

  • ConnectListener callbacks for connectionClosedOnError, reconnectingIn (multiple times for the countdown), & reconnectionSuccessful are called… but the XMPP server is still down, which is head-scratcher #2.

Because reconnectionSuccessful was called before the XMPP Server was brought back up, the client is now forever offline because it’s in a state where it thinks it’s reconnected.

What could possibly be causing this behavior? Has anyone else seen anything like this?