bgk6668 2018-07-13 06:11 采纳率: 33.3%
浏览 1755
已结题

android smack 建立连接连不上

    private static final String DOMAIN = "61.153.189.64:8022";
private static final String HOST = "61.153.189.64";
private static final int PORT = 8022;
private String userName ="admin";
private String passWord = "admin";
    XMPPTCPConnectionConfiguration config = XMPPTCPConnectionConfiguration.builder()
                .setUsernameAndPassword(userName, passWord)
                .setSecurityMode(ConnectionConfiguration.SecurityMode.disabled)
                .setXmppDomain(JidCreate.domainBareFrom(DOMAIN))
                .setHost(HOST)
                .setPort(PORT)
                .setConnectTimeout(100000)
                .setCompressionEnabled(false)
                .setHostAddress(InetAddress.getByName(HOST))
                .setDebuggerEnabled(true)
                .build();

                    AbstractXMPPConnection conn = new XMPPTCPConnection(config);
        conn.connect();
        conn.login(userName,passWord);




                    implementation files('libs/smack-android-4.2.4.jar')
implementation files('libs/smack-android-extensions-4.2.4.jar')
implementation files('libs/smack-core-4.2.4.jar')
implementation files('libs/smack-extensions-4.2.4.jar')
implementation files('libs/smack-im-4.2.4.jar')
implementation files('libs/smack-resolver-minidns-4.2.4.jar')
implementation files('libs/smack-sasl-provided-4.2.4.jar')
implementation files('libs/smack-tcp-4.2.4.jar')
implementation files('libs/xpp3-1.1.4c.jar')
implementation files('libs/org.xbill.dns_2.1.6.jar')
implementation files('libs/jxmpp-core-0.4.1.jar')
implementation files('libs/jxmpp-util-cache-0.4.1.jar')
api 'de.measite.minidns:minidns-hla:0.2.4'
implementation files('libs/jxmpp-jid-0.4.1.jar')





    错误信息

    07-13 06:09:37.025 18543-18667/com.som.chatxmpp I/xmppConnect: org.jivesoftware.smack.SmackException$NoResponseException: No response received within reply timeout. Timeout was 5000ms (~5s). While waiting for establishing TLS

07-13 06:09:37.027 18543-18669/com.som.chatxmpp W/AbstractXMPPConnection: Connection XMPPTCPConnectionnot-authenticated closed with error
org.xmlpull.v1.XmlPullParserException: Unexpected token (position:TEXT HTTP/1.1 400 Bad...@8:1 in org.jivesoftware.smack.util.ObservableReader@3d8b3bb)
at org.kxml2.io.KXmlParser.next(KXmlParser.java:432)
at org.kxml2.io.KXmlParser.next(KXmlParser.java:313)
at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader.parsePackets(XMPPTCPConnection.java:1248)
at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader.access$300(XMPPTCPConnection.java:1000)
at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader$1.run(XMPPTCPConnection.java:1016)
at java.lang.Thread.run(Thread.java:761)

            07-13 06:09:32.025 18543-18668/com.som.chatxmpp D/SMACK: SENT (1): <stream:stream xmlns='jabber:client' to='61.153.189.64:8222' xmlns:stream='http://etherx.jabber.org/streams' version='1.0' from='admin@61.153.189.64:8222' xml:lang='en'>

07-13 06:09:32.070 18543-18669/com.som.chatxmpp D/SMACK: RECV (1): HTTP/1.1 400 Bad Request
Server: nginx/1.10.3
Date: Fri, 13 Jul 2018 06:08:11 GMT
Content-Type: text/html; charset=utf-8
Content-Length: 173
Connection: close

<html>
<head><title>400 Bad Request</title></head>
<body bgcolor="white">
<center><h1>400 Bad Request</h1></center>
<hr><center>nginx/1.10.3</center>
</body>
</html>
  • 写回答

6条回答 默认 最新

  • qq_33645170 2018-07-13 06:17
    关注

    是不是没有导入jar包啊,确定下

    评论

报告相同问题?

悬赏问题

  • ¥15 求差集那个函数有问题,有无佬可以解决
  • ¥15 MATLAB动图问题
  • ¥15 【提问】基于Invest的水源涵养
  • ¥20 微信网友居然可以通过vx号找到我绑的手机号
  • ¥15 寻一个支付宝扫码远程授权登录的软件助手app
  • ¥15 解riccati方程组
  • ¥15 display:none;样式在嵌套结构中的已设置了display样式的元素上不起作用?
  • ¥15 使用rabbitMQ 消息队列作为url源进行多线程爬取时,总有几个url没有处理的问题。
  • ¥15 Ubuntu在安装序列比对软件STAR时出现报错如何解决
  • ¥50 树莓派安卓APK系统签名