aSmack 4.0。* XMPPTCPConnection无法连接到的Openfire和Ejabbered(SmackException $ NoResponseException) [英] aSmack 4.0.* XMPPTCPConnection can't connect to OpenFire and Ejabbered (SmackException$NoResponseException)

查看:843
本文介绍了aSmack 4.0。* XMPPTCPConnection无法连接到的Openfire和Ejabbered(SmackException $ NoResponseException)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的 asmack-Android的8源-4.0.6

当我尝试连接到服务器无论是Openfire的或Ejabbered我得到这个例外

when i try to connect to the server whether it is openFire or Ejabbered i get this exception

org.jivesoftware.smack.SmackException $ NoResponseException

org.jivesoftware.smack.SmackException$NoResponseException

这是我的code:

        SmackAndroid.init(getApplicationContext());
        ConnectionConfiguration conConfig = new ConnectionConfiguration(HOST, PORT);
        conConfig.setDebuggerEnabled(true);

        connection = new XMPPTCPConnection(conConfig);
        try {
            connection.connect();
            Log.i("AppName", "CONNECTED TO " + connection.getHost());
        }

当我打电话

connection.connect();

connection.connect();

我得到这个异​​常:

org.jivesoftware.smack.SmackException $ NoResponseException

org.jivesoftware.smack.SmackException$NoResponseException

请注意我已尝试在同一code asmack-Android的19-0.8.10 ,它完美的作品

note the i have tried the same code on asmack-android-19-0.8.10 and it works perfectly

我想这个问题是与

XMPPTCPConnection

XMPPTCPConnection

因为 asmack-Android的19-0.8.10 我用

XMPPConnection

XMPPConnection

任何帮助吗?

推荐答案

我已经找到了问题的所有我所做的是加入这一行:

I have found the problem all i did is adding this line:

ConnectionConfiguration.setSecurityMode(SecurityMode.disabled);

和我连接到服务器成功

这是我的最终配置:

ConnectionConfiguration ConnectionConfiguration =  new ConnectionConfiguration(HOST, PORT);
ConnectionConfiguration.setDebuggerEnabled(true);
ConnectionConfiguration.setSecurityMode(SecurityMode.disabled);

这篇关于aSmack 4.0。* XMPPTCPConnection无法连接到的Openfire和Ejabbered(SmackException $ NoResponseException)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆