AnsweredAssumed Answered

Smack 4.2.0-rc2 AbstractXMPPConnection#connect() does not return "policy-violation" to the calling application.

Question asked by cmeng on Jan 5, 2017
Latest reply on Jan 11, 2017 by cmeng

When making an xmpp connection to a xmpp server, if the server returns a <policy-violation xmlns='urn:ietf:params:xml:ns:xmpp-streams'>, this is not propagated to the calling application. Instead it is returned as:

{SmackException$NoResponseException@22122} "org.jivesoftware.smack.SmackException$NoResponseException: No response received within reply timeout. Timeout was 5000ms (~5s). While waiting for SASL mechanisms stream feature from server"

 

For application implementation, it may be important to inform the user if there is an <policy-violation> and the connection is only unblocked at xx.xx.xx. Otherwise use may continuously attempt to login without knowing he has been blocked until xx.xx.xx.

 

============ Smack log showing the <policy violation =========================

01-06 12:07:03.695 8509-9341/org.atalk.android D/SMACK: SENT (0): <stream:stream xmlns='jabber:client' to='jabbim.com' xmlns:stream='http://etherx.jabber.org/streams' version='1.0' xml:lang='en'>

01-06 12:07:04.085 8509-9342/org.atalk.android D/SMACK: RECV (0): <?xml version='1.0'?><stream:stream xmlns='jabber:client' xmlns:stream='http://etherx.jabber.org/streams' id='6785787028201586334' from='jabbim.com' version='1.0' xml:lang='en'><stream:error><policy-violation xmlns='urn:ietf:params:xml:ns:xmpp-streams'></policy-violation><text xml:lang='en' xmlns='urn:ietf:params:xml:ns:xmpp-streams'>Too many (2) failed authentications from this IP address (1xx.66.xx.xxx). The address will be unblocked at 04:24:00 06.01.2017 UTC</text></stream:error></stream:stream>

01-06 12:07:08.695 8509-9342/org.atalk.android W/αTalk: [4] org.jivesoftware.smack.AbstractXMPPConnection.callConnectionClosedOnErrorListen er() Connection XMPPTCPConnection[not-authenticated] (0) closed with error

                                                        org.jivesoftware.smack.XMPPException$StreamErrorException: policy-violation You can read more about the meaning of this stream error at http://xmpp.org/rfcs/rfc6120.html#streams-error-conditions

                                                        <stream:error><policy-violation xmlns='urn:ietf:params:xml:ns:xmpp-streams'/><text xml:lang='en'>Too many (2) failed authentications from this IP address (1xx.66.xx.xxx). The address will be unblocked at 04:24:00 06.01.2017 UTC</text></stream:error>

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

                                                            at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader.access$300(XMPPTCPCon nection.java:969)

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

                                                            at java.lang.Thread.run(Thread.java:818)

01-06 12:07:08.695 8509-9342/org.atalk.android E/αTalk: [4] impl.protocol.jabber.ProtocolProviderServiceJabberImpl.connectionClosedOnError( ).2203 connectionClosedOnError policy-violation You can read more about the meaning of this stream error at http://xmpp.org/rfcs/rfc6120.html#streams-error-conditions

                                                        <stream:error><policy-violation xmlns='urn:ietf:params:xml:ns:xmpp-streams'/><text xml:lang='en'>Too many (2) failed authentications from this IP address (1xx.66.xx.xxx). The address will be unblocked at 04:24:00 06.01.2017 UTC</text></stream:error>

                                                        org.jivesoftware.smack.XMPPException$StreamErrorException: policy-violation You can read more about the meaning of this stream error at http://xmpp.org/rfcs/rfc6120.html#streams-error-conditions

                                                        <stream:error><policy-violation xmlns='urn:ietf:params:xml:ns:xmpp-streams'/><text xml:lang='en'>Too many (2) failed authentications from this IP address (1xx.66.xx.xxx). The address will be unblocked at 04:24:00 06.01.2017 UTC</text></stream:error>

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

                                                            at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader.access$300(XMPPTCPCon nection.java:969)

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

                                                            at java.lang.Thread.run(Thread.java:818)

                                                           

================Variables of Exception returns to calling application ==========================                                                           

Exception e = {SmackException$NoResponseException@22122} "org.jivesoftware.smack.SmackException$NoResponseException: No response received within reply timeout. Timeout was 5000ms (~5s). While waiting for SASL mechanisms stream feature from server"

filter = null

cause = {SmackException$NoResponseException@22122} "org.jivesoftware.smack.SmackException$NoResponseException: No response received within reply timeout. Timeout was 5000ms (~5s). While waiting for SASL mechanisms stream feature from server"

detailMessage = "No response received within reply timeout. Timeout was 5000ms (~5s). While waiting for SASL mechanisms stream feature from server"

stackState = {Object[10]@22132}

stackTrace = {StackTraceElement[0]@22133}

suppressedExceptions = {Collections$EmptyList@22134}  size = 0

shadow$_klass_ = {Class@20719} "class org.jivesoftware.smack.SmackException$NoResponseException"

shadow$_monitor_ = -1541682932

mConnection = {XMPPTCPConnection@22098} "XMPPTCPConnection[not-authenticated] (0)"

Outcomes