使用tigase.jaxmpp.j2se.Jaxmpp 3.0.0

时间:2015-09-29 12:31:40

标签: java exception xmpp socketexception tigase

我编写了一个使用tigase.jaxmpp.j2se.Jaxmpp 3.0.0的JAXMPPClient.java程序

我的构建路径中有以下.jar文件

jaxmpp-core-3.0.0
jaxmpp-j2se-3.0.0

和包含许多.jar文件的文件夹jaxmpp-all-3.0.0。 JAXMPPClient.java如下

Jaxmpp conn = new Jaxmpp();
conn.getConnectionConfiguration().setConnectionType(
    ConnectionType.socket);
conn.getConnectionConfiguration().setDomain(IP_ADDRESS_OF_XMPP_SERVER);
conn.getConnectionConfiguration().setPort(PORT_NUMBER_OF_XMPP_SERVER);
conn.getConnectionConfiguration().setUserJID(FROM_USERID + "@" +
    IP_ADDRESS_OF_XMPP_SERVER);
conn.getConnectionConfiguration().setUserPassword(FROM_PASSWORD);

String s = tigase.jaxmpp.j2se.connectors.socket.
    SocketConnector.HOSTNAME_VERIFIER_DISABLED_KEY
conn.getSessionObject().setProperty(s, Boolean.TRUE);

try {
    System.out.println("Before login");
    conn.login();
    System.out.println("After login");
} catch (final JaxmppException e) {
    e.printStackTrace();
}

我正在

Before login
Sep 29, 2015 5:17:12 PM tigase.jaxmpp.j2se.Jaxmpp createConnector
INFO: Using SocketConnector
Sep 29, 2015 5:17:12 PM tigase.jaxmpp.j2se.connectors.socket.SocketConnector start
INFO: Resolving SRV recrd of domain '123.45.678.910'
Sep 29, 2015 5:17:12 PM tigase.jaxmpp.j2se.connectors.socket.SocketConnector start
INFO: Opening connection to /123.45.678.910:5222
Sep 29, 2015 5:17:12 PM tigase.jaxmpp.j2se.connectors.socket.Worker run
WARNING: Exception in worker
java.net.SocketException: Connection reset
    at java.net.SocketInputStream.read(SocketInputStream.java:209)
    at java.net.SocketInputStream.read(SocketInputStream.java:141)
    at tigase.jaxmpp.j2se.connectors.socket.TextStreamReader.read(TextStreamReader.java:49)
    at tigase.jaxmpp.j2se.connectors.socket.Worker.run(Worker.java:99)

After login

IP地址,端口号,来自JabberID和密码是正确的,并且可以在iOS和Android应用程序中正常运行。此外,我能够成功ping通Tigase服务器IP地址。

从哪里抛出java.net.SocketException?我该如何解决这个问题?

0 个答案:

没有答案