AnsweredAssumed Answered

NoResponseException smack 4.1.1

Question asked by James Bouchard on Apr 21, 2015
Latest reply on Apr 22, 2015 by Flow

Hi, I am recieving a NoResponseException when making a xmpp connection. I am not expecting a response in the application after I send a message through the connection. Below is where I am using the code to make the connection and the call to the connect method. It seems that I get a response later after 5 min instead of 5s. Is there away around this besides setting the packet reply time out to a greater amount?

 

Thanks in advance,

 

James B

 

 

 

androidNotificationHandler.connect(senderId, password);

 

 

 

  public void connect(long senderId, String apiKey)

             throws XMPPException, IOException, SmackException {

      XMPPTCPConnectionConfiguration config = XMPPTCPConnectionConfiguration.builder()

    

      .setSecurityMode(XMPPTCPConnectionConfiguration.SecurityMode.disabled)

      .setPort(AndroidNotificationHandler.GCM_PORT)

      .setHost(AndroidNotificationHandler.GCM_SERVER)

      .setSocketFactory(SSLSocketFactory.getDefault())

      .setServiceName(AndroidNotificationHandler.GCM_SERVER)

      .setDebuggerEnabled(true)

      .build();   

    

         connection = new XMPPTCPConnection(config);

         connection.setPacketReplyTimeout(10000L);

         connection.removeAllStanzaAcknowledgedListeners();

         connection.connect();

         connection.login(senderId + "@gcm.googleapis.com", apiKey);

  }   

 

 

 

 

11:06:11 PM SENT (0): <stream:stream xmlns='jabber:client' to='gcm.googleapis.com' xmlns:stream='http://etherx.jabber.org/streams' version='1.0' xml:lang='en'>

11:06:11 PM RECV (0): <stream:stream from="gcm.googleapis.com" id="08EF9F0DE2952851" version="1.0" xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client">

11:06:11 PM RECV (0): <stream:features><mechanisms xmlns="urn:ietf:params:xml:ns:xmpp-sasl"><mechanism>X-OAUTH2</mechanism><mechan ism>X-GOOGLE-TOKEN</mechanism><mechanism>PLAIN</mechanism></mechanisms></stream: features>

11:06:11 PM SENT (0): <auth xmlns='urn:ietf:params:xml:ns:xmpp-sasl' mechanism='PLAIN'>ADgzNjA5MjE1Nzk4OUBnY20uZ29vZ2xlYXBpcy5jb20AQUl6YVN5RGNleXFfM DNLNkhsM0RMN2hrWUdlYW1nM3d2d3JzU09V</auth>

11:06:12 PM RECV (0): <success xmlns="urn:ietf:params:xml:ns:xmpp-sasl"/>

11:06:12 PM SENT (0): <stream:stream xmlns='jabber:client' to='gcm.googleapis.com' xmlns:stream='http://etherx.jabber.org/streams' version='1.0' id='08EF9F0DE2952851' xml:lang='en'>

11:06:12 PM RECV (0): <stream:stream from="gcm.googleapis.com" id="446DF2621F37A2D7" version="1.0" xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client">

11:06:12 PM RECV (0): <stream:features><bind xmlns="urn:ietf:params:xml:ns:xmpp-bind"/><session xmlns="urn:ietf:params:xml:ns:xmpp-session"/></stream:features>

11:06:12 PM SENT (0): <iq id='PPgTi-4' type='set'><bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'><resource>Smack</resource></bind></iq>

11:06:12 PM RECV (0): <iq id="PPgTi-4" type="result"><bind xmlns="urn:ietf:params:xml:ns:xmpp-bind"><jid>836092157989@gcm.googleapis.com/SmackF34A92C9</jid></bind></iq>

11:06:12 PM RECV (0): 

11:06:12 PM SENT (0): <iq id='PPgTi-6' type='set'><session xmlns='urn:ietf:params:xml:ns:xmpp-session'/></iq>

11:06:12 PM RECV (0): <iq type="result" id="PPgTi-6"/>

11:06:12 PM User logged (0): 836092157989@gcm.googleapis.com:5235/SmackF34A92C9

11:06:12 PM XMPPConnection authenticated (0)

11:06:12 PM SENT (0): <iq id='PPgTi-8' type='get'><query xmlns='jabber:iq:roster'></query></iq>

11:06:12 PM SENT (0): <presence id='PPgTi-9'><c xmlns='http://jabber.org/protocol/caps' hash='sha-1' node='http://www.igniterealtime.org/projects/smack' ver='os2Kusj3WEOivn5n4iFr/ZEO8ls='/></presence>

2015-04-21 23:06:12,318 DEBUG AndroidNotification com.gamerparentsinc.notification.AndroidNotification - Sending notification, Testing notification for token 123456

11:06:12 PM SENT (0): <message id='PPgTi-10'><gcm xmlns='google:mobile:data'>{"delay_while_idle":true,"data":{"EmbeddedMessageId" :"messageId-88596421-f325-400d-92e1-595e4224d6a2","message":"Testing notification"},"time_to_live":10000,"message_id":"messageId-88596421-f325-400d- 92e1-595e4224d6a2","to":"123456"}</gcm></message>

11:06:12 PM RECV (0): <message><data:gcm xmlns:data="google:mobile:data">{"message_id":"messageId-88596421-f325-400d-92e 1-595e4224d6a2","from":"123456","error_description":"","error":"BAD_REGISTRATION ","message_type":"nack"}</data:gcm></message>

Apr 21, 2015 11:06:22 PM org.jivesoftware.smack.roster.Roster$3 processException

SEVERE: Exception reloading roster

org.jivesoftware.smack.SmackException$NoResponseException: No response received within reply timeout. Timeout was 10000ms (~10s). Used filter: IQReplyFilter: iqAndIdFilter (AndFilter: (OrFilter: (IQTypeFilter: type=error, IQTypeFilter: type=result), StanzaIdFilter: id=PPgTi-8)), : fromFilter (OrFilter: (FromMatchesFilter (full): null, FromMatchesFilter (bare): 836092157989@gcm.googleapis.com, FromMatchesFilter (full): gcm.googleapis.com)).

  at org.jivesoftware.smack.SmackException$NoResponseException.newWith(SmackExceptio n.java:106)

  at org.jivesoftware.smack.AbstractXMPPConnection$6.run(AbstractXMPPConnection.java :1438)

  at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)

  at java.util.concurrent.FutureTask.run(FutureTask.java:266)

  at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201 (ScheduledThreadPoolExecutor.java:180)

  at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Schedu ledThreadPoolExecutor.java:293)

  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)

  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)

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

Outcomes