Smack api for android, Connection.isConnected()

I am testing my chat app on android.

one of the test scenarios is when I turn off the wifi on my server, The client thinks it is still connected, because isConnected() method returns true.

So I am unable to validate the connection in this particular scenario. Any thoughts on this problem? Thank you.