I am trying to connect my Spark client through a proxy server using last Smack 3.1.0 library. The proxy I use is an Http proxy and when I supply the correct proxy settings I log successfully through it.
Some times, like when I introduce as protocol "SOCKS" (a wrong one), login panel hang ups in instruction "connection.connect()" (connection is a Xmppconnection). I have put a timer in order to exit this code and then change proxy settings to right ones.
My problem is that when I change the protocol to "HTTP" and try to connect with the correct settings after the timer, the applications hangs again. If I close the application and try again, it works.
I have examined the open connections in my computer before exiting and I can see two established TCP connections to my proxy server (every attemp, SOCKS and HTTP has opened one). This connections only shut down when I completely close muy application.
How can I completely close this connection before every attemp without exiting as this seems to be the problem? After my timer completes, the variable xmppconnection has not connected, so I can not close it to try again, but the proxy server's tcp connection keeps established.