[Android 13] Connection issues after VPN connection

Hi everyone! I have very strange connection issue.
I develop android application with smack client library(4.4.6) + openfire server
My device is Samsung s22, android 13, wifi-only (3g - no problems)

I downloaded and installed VPN (before installation → XMPP-connection worked well)

I enabled VPN - all is good
But when i disable VPN - app can’t connect to xmpp (via wifi) with SocketException
Another apps works good (Telegram, WhatsApp, etc)
Any ideas?

java.net.SocketException: Connection reset
	at java.net.SocketInputStream.read(SocketInputStream.java:191)
	at java.net.SocketInputStream.read(SocketInputStream.java:143)
	at sun.nio.cs.StreamDecoder.readBytes(StreamDecoder.java:291)
	at sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:355)
	at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:181)
	at java.io.InputStreamReader.read(InputStreamReader.java:180)
	at java.io.BufferedReader.read1(BufferedReader.java:221)
	at java.io.BufferedReader.read(BufferedReader.java:298)
	at org.jivesoftware.smack.util.ObservableReader.read(ObservableReader.java:42)
	at com.android.org.kxml2.io.KXmlParser.fillBuffer(KXmlParser.java:1516)
	at com.android.org.kxml2.io.KXmlParser.peekType(KXmlParser.java:993)
	at com.android.org.kxml2.io.KXmlParser.next(KXmlParser.java:349)
	at com.android.org.kxml2.io.KXmlParser.next(KXmlParser.java:313)
	at org.jivesoftware.smack.xml.xpp3.Xpp3XmlPullParser.next(Xpp3XmlPullParser.java:228)
	at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader.parsePackets(XMPPTCPConnection.java:1143)
	at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader.access$700(XMPPTCPConnection.java:916)
	at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader$1.run(XMPPTCPConnection.java:939)
	at java.lang.Thread.run(Thread.java:1012)

The error that is shown is a very generic network error. We can’t really tell anything from this other than that the network connection cannot be established.

As Guus already said: This is someone terminating the underlying TCP connection. It could be the remote side, but could be something in between just as likely. Actually, the latter is even more likely, as the internet is experiencing a “pandemic” of middle-boxes terminating “long” lasting TCP connections. There is not much you can do about it if that happens, besides re-establishing the XMPP connection.

You are right. Probably some routers blocks 5222 port. We made test host where mapped 443 to 5222 port (so we make xmpp connection to host:443) It seems it works. Thank you for responses!

This topic was automatically closed 62 days after the last reply. New replies are no longer allowed.