powered by Jive Software

Smack 4.2 alpha1 - Disconnecting from server after a minute (SmackException: Parser got END_DOCUMENT event)

The problem is that after a minute of connection exception you can see below occurs.

SENT (0): <stream:stream xmlns=‘jabber:client’ to=‘domain.com’ xmlns:stream=‘http://etherx.jabber.org/streams’ version=‘1.0’ from=‘userName@domain.com@domain.com’ xml:lang=‘en’>

RECV (0): <?xml version='1.0' encoding='UTF-8'?><stream:stream xmlns:stream=“http://etherx.jabber.org/streams” xmlns=“jabber:client” from=“domain.com” id=“487d8246” xml:lang=“en” version=“1.0”>

RECV (0): stream:featuresDIGEST-MD5PLAINANONYMOUSCRAM-MD5</mech anism>zlib</stream:features>

D/ZAQ-ChatConnection﹕ connected

SENT (0): =

RECV (0): cmV…XNz

SENT (0): dXN…i04

RECV (0): cnN…mNw==

SENT (0): <stream:stream xmlns=‘jabber:client’ to=‘domain.com’ xmlns:stream=‘http://etherx.jabber.org/streams’ version=‘1.0’ from=‘userName@domain.com@domain.com’ id=‘487d8246’ xml:lang=‘en’>

RECV (0): <?xml version='1.0' encoding='UTF-8'?><stream:stream xmlns:stream=“http://etherx.jabber.org/streams” xmlns=“jabber:client” from=“domain.com” id=“487d8246” xml:lang=“en” version=“1.0”>stream:featureszlib</stream:features>

SENT (0): Smack

RECV (0): userName@domain.com/Smack

SENT (0):

RECV (0):

User logged (0): userName@domain.com:5223/Smack

D/ZAQ-ChatConnection﹕ authenticated

XMPPConnection authenticated (0)

SENT (0):

RECV (0):

03-08 07:33:05.428 RECV (0):

03-08 07:34:05.318 2807-3267/com.myapp.name W/AbstractXMPPConnection﹕ Connection closed with error

** org.jivesoftware.smack.SmackException: Parser got END_DOCUMENT event. This could happen e.g. if the server closed the connection without sending a closing stream element**

** at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader.parsePackets(XMPPTCPC onnection.java:1126)**

** at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader.access$200(XMPPTCPCon nection.java:915)**

** at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader$1.run(XMPPTCPConnecti on.java:930)**

** at java.lang.Thread.run(Thread.java:841)**

D/ZAQ-ChatConnection﹕ connectionClosedOnErrororg.jivesoftware.smack.SmackException: Parser got END_DOCUMENT event. This could happen e.g. if the server closed the connection without sending a closing stream element

I found the solution:

1.PNG2.PNG

XMPPTCPConnectionConfiguration.Builder config = XMPPTCPConnectionConfiguration.builder();

config.setSendPresence(true);

My smack version is 4.2.0-beta2. I have process by your step, but not effect. why?