网络改变后还是不能自动重连...
关闭WiFi的时候,报错误:
01-21 09:34:23.872: E/Androidpn_XmppManager(1512): XMPP connection failed
01-21 09:34:23.872: E/Androidpn_XmppManager(1512): 192.168.3.100:5222 Exception: XMPPError connecting to 192.168.3.100:5222.; : remote-server-error(502)
01-21 09:34:23.872: E/Androidpn_XmppManager(1512): -- caused by: XMPPError connecting to 192.168.3.100:5222.: remote-server-error(502) XMPPError connecting to 192.168.3.100:5222.
01-21 09:34:23.872: E/Androidpn_XmppManager(1512): -- caused by: java.net.ConnectException: failed to connect to /192.168.3.100 (port 5222): connect failed: ENETUNREACH (Network is unreachable)
01-21 09:34:23.872: E/Androidpn_XmppManager(1512): at org.jivesoftware.smack.XMPPConnection.connectUsingConfiguration(XMPPConnection.java:601)
01-21 09:34:23.872: E/Androidpn_XmppManager(1512): at org.jivesoftware.smack.XMPPConnection.connect(XMPPConnection.java:1021)
01-21 09:34:23.872: E/Androidpn_XmppManager(1512): at org.androidpn.client.XmppManager$ConnectTask.run(XmppManager.java:307)
01-21 09:34:23.872: E/Androidpn_XmppManager(1512): at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:442)
01-21 09:34:23.872: E/Androidpn_XmppManager(1512): at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
01-21 09:34:23.872: E/Androidpn_XmppManager(1512): at java.util.concurrent.FutureTask.run(FutureTask.java:137)
01-21 09:34:23.872: E/Androidpn_XmppManager(1512): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
01-21 09:34:23.872: E/Androidpn_XmppManager(1512): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
01-21 09:34:23.872: E/Androidpn_XmppManager(1512): at java.lang.Thread.run(Thread.java:856)
01-21 09:34:23.872: E/Androidpn_XmppManager(1512): Nested Exception:
01-21 09:34:23.872: E/Androidpn_XmppManager(1512): XMPPError connecting to 192.168.3.100:5222.: remote-server-error(502) XMPPError connecting to 192.168.3.100:5222.
01-21 09:34:23.872: E/Androidpn_XmppManager(1512): -- caused by: java.net.ConnectException: failed to connect to /192.168.3.100 (port 5222): connect failed: ENETUNREACH (Network is unreachable)
01-21 09:34:23.872: E/Androidpn_XmppManager(1512): at org.jivesoftware.smack.XMPPConnection.connectUsingConfiguration(XMPPConnection.java:574)
01-21 09:34:23.872: E/Androidpn_XmppManager(1512): at org.jivesoftware.smack.XMPPConnection.connect(XMPPConnection.java:1021)
01-21 09:34:23.872: E/Androidpn_XmppManager(1512): at org.androidpn.client.XmppManager$ConnectTask.run(XmppManager.java:307)
01-21 09:34:23.872: E/Androidpn_XmppManager(1512): at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:442)
01-21 09:34:23.872: E/Androidpn_XmppManager(1512): at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
01-21 09:34:23.872: E/Androidpn_XmppManager(1512): at java.util.concurrent.FutureTask.run(FutureTask.java:137) 等...
接着我重新连上WiFi后,log先打印:
01-21 09:34:34.696: I/Androidpn_ConnectivityReceiver(1512): Network connected
然后就一直重复打印下面的log:
01-21 09:34:34.696: D/Androidpn_NotificationService(1512): connect()...
01-21 09:34:34.696: D/Androidpn_XmppManager(1512): connect()...
01-21 09:34:34.696: D/Androidpn_XmppManager(1512): submitLoginTask()...
01-21 09:34:34.696: D/Androidpn_XmppManager(1512): submitRegisterTask()...
01-21 09:34:34.696: D/Androidpn_XmppManager(1512): submitConnectTask()...
01-21 09:34:34.696: D/Androidpn_XmppManager(1512): addTask(runnable)...
01-21 09:34:34.696: D/Androidpn_NotificationService(1512): Incremented task count to 9
01-21 09:34:34.696: D/Androidpn_XmppManager(1512): addTask(runnable)... done
01-21 09:34:34.696: D/Androidpn_XmppManager(1512): addTask(runnable)...
01-21 09:34:34.696: D/Androidpn_NotificationService(1512): Incremented task count to 10
01-21 09:34:34.696: D/Androidpn_XmppManager(1512): addTask(runnable)... done
01-21 09:34:34.696: D/Androidpn_XmppManager(1512): addTask(runnable)...
01-21 09:34:34.696: D/Androidpn_NotificationService(1512): Incremented task count to 11
01-21 09:34:34.696: D/Androidpn_XmppManager(1512): addTask(runnable)... done
01-21 09:34:43.864: D/Androidpn_XmppManager(1512): connect()...
问题出在哪里呢?