Android a-smack connection issue: wifi connection is connected and active but wifi has no internet connection

I am using org.igniterealtime.smack:smack-android-extensions:4.1.8 and org.igniterealtime.smack:smack-tcp:4.1.8 for XMPP chat in my android application.

Everything is working fine but the problem is if there is no internet available on the wifi network to which I am connected.

In this case the xmpp connection behave as connected and alive and never tires to reconnect in any case.

How do I receive an event when the wifi looses/gains internet connection and reconnect the xmpp connection in this scenario?