Hi,
I am currently playing around with android XMPP client development using the Mar-24 0.9 snapshot version of asmack, and I am having trouble connecting to my OpenFire server.
The OpenFire server is configured to require secure connections.
This is my connect code:
publicvoid connect() { Thread t = new Thread(new Runnable() { //@Override publicvoid run() { SmackAndroid.init(getApplicationContext()); ConnectionConfiguration connConfig = new ConnectionConfiguration(HOST, PORT, "test"); connConfig.setReconnectionAllowed(true); connConfig.setDebuggerEnabled(true); connConfig.setSecurityMode(ConnectionConfiguration.SecurityMode.required); connConfig.setCompressionEnabled(true); try{ SSLContext sc = SSLContext.getInstance("TLS"); connConfig.setCustomSSLContext(sc); }catch (NoSuchAlgorithmException e) { e.printStackTrace(); } XMPPConnection connection = new TCPConnection(connConfig); connection.DEBUG_ENABLED = true; try{ Log.i("test", "Connecting..."); connection.connect(); }catch (SmackException e) { e.printStackTrace(); }catch (IOException e) { e.printStackTrace(); }catch (XMPPException e) { e.printStackTrace(); } Log.i("test", "Authenticating..."); try{ connection.login(USERNAME,PASSWORD); Log.i("test", "Authenticated!"); }catch (Exception e) { e.printStackTrace(); } } }); t.start(); }
And the logs are as follows:
03-24 16:02:03.021 4082-4095/com.smuggr.smuggr I/test﹕ Connecting...
03-24 16:02:03.121 4082-4097/com.smuggr.smuggr D/SMACK﹕ SENT (0): <stream:stream to="test" xmlns="jabber:client" xmlns:stream="http://etherx.jabber.org/streams" version="1.0">
03-24 16:02:03.221 4082-4098/com.smuggr.smuggr D/SMACK﹕ RCV (0): <?xml version='1.0' encoding='UTF-8'?><stream:stream xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client" from="<openfire URL>" id="a0e8ff33" xml:lang="en" version="1.0">
03-24 16:02:03.301 4082-4098/com.smuggr.smuggr D/SMACK﹕ RCV (0): <stream:features><starttls xmlns="urn:ietf:params:xml:ns:xmpp-tls"><required/></starttls><mechanisms xmlns="urn:ietf:params:xml:ns:xmpp-sasl"><mechanism>DIGEST-MD5</mechanism><mechanism>PLAIN</mechanism><mechanism>CRAM-MD5</mechanism></mechanisms></stream:features>
03-24 16:02:03.301 4082-4098/com.smuggr.smuggr D/SMACK﹕ SENT (0): <starttls xmlns="urn:ietf:params:xml:ns:xmpp-tls"/>
03-24 16:02:03.401 4082-4098/com.smuggr.smuggr D/SMACK﹕ RCV (0): <proceed xmlns="urn:ietf:params:xml:ns:xmpp-tls"/>
03-24 16:02:03.401 4082-4097/com.smuggr.smuggr D/SMACK﹕ SENT (0): </stream:stream>
03-24 16:02:18.141 4082-4095/com.smuggr.smuggr I/test﹕ Authenticating...
03-24 16:02:48.152 4082-4095/com.smuggr.smuggr W/System.err﹕ org.jivesoftware.smack.SmackException$NoResponseException
03-24 16:02:48.152 4082-4095/com.smuggr.smuggr W/System.err﹕ at org.jivesoftware.smack.SASLAuthentication.authenticate(SASLAuthentication.java:354)
03-24 16:02:48.152 4082-4095/com.smuggr.smuggr W/System.err﹕ at org.jivesoftware.smack.TCPConnection.login(TCPConnection.java:236)
03-24 16:02:48.152 4082-4095/com.smuggr.smuggr W/System.err﹕ at org.jivesoftware.smack.XMPPConnection.login(XMPPConnection.java:393)
03-24 16:02:48.152 4082-4095/com.smuggr.smuggr W/System.err﹕ at com.smuggr.smuggr.MainActivity$1.run(MainActivity.java:102)
03-24 16:02:48.152 4082-4095/com.smuggr.smuggr W/System.err﹕ at java.lang.Thread.run(Thread.java:841)
Any form of help would be greatly appreciated!
Thank you in advance.