Android Xmppconnection与韵律服务器

时间:2017-05-22 09:08:51

标签: java android xmpp messaging prosody-im

我可以连接我的本地服务器(韵律)但是当我尝试连接托管服务器时,我无法连接。

这是我的连接请求

  XMPPTCPConnectionConfiguration.XMPPTCPConnectionConfigurationBuilder builder =
            XMPPTCPConnectionConfiguration.builder();

    builder.setServiceName("my_service_name");
    builder.setHost("xx.xx.xxx.xxx"); // my host name
    builder.setPort(5281); // myport name (i have used 5281 for https as per the prosody docs )
    builder.setUsernameAndPassword(mUsername, mPassword);
    builder.setRosterLoadedAtLogin(true);
    builder.setResource("Rooster");

    mConnection = new XMPPTCPConnection(builder.build());
    mConnection.addConnectionListener(this);
    mConnection.connect();
    mConnection.login();

当我尝试连接时,我收到如下所示的XmppPullparser异常,请帮帮我。

W/AbstractXMPPConnection: Connection closed with error
                                                                    org.xmlpull.v1.XmlPullParserException: Unexpected token (position:TEXT HTTP/1.1 400 Bad...@8:1 in java.io.BufferedReader@2d9e3b7) 
                                                                        at org.kxml2.io.KXmlParser.next(KXmlParser.java:440)
                                                                        at org.kxml2.io.KXmlParser.next(KXmlParser.java:321)
                                                                        at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader.parsePackets(XMPPTCPConnection.java:1170)
                                                                        at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader.access$200(XMPPTCPConnection.java:931)

0 个答案:

没有答案