我想开发一个连接到 Google Talk 并允许用户与其朋友聊天的 Java 应用程序。我正在使用 smack API 和下面的代码:
ConnectionConfiguration config = new ConnectionConfiguration("talk.google.com",5222,"gmail.com");
SASLAuthentication.supportSASLMechanism("PLAIN", 0);
XMPPConnection connection = new XMPPConnection(config);
try {
connection.connect();
} catch (XMPPException e) {
e.printStackTrace();
}
try {
connection.login("username", "password");
} catch (XMPPException e) {
e.printStackTrace();
}
但我得到了休闲例外:
SASL authentication PLAIN failed: invalid-authzid:
at org.jivesoftware.smack.SASLAuthentication.authenticate(SASLAuthentication.java:337)
at org.jivesoftware.smack.XMPPConnection.login(XMPPConnection.java:203)
at org.jivesoftware.smack.Connection.login(Connection.java:348)
at Main.main(Main.java:21)
有人可以帮我解决这个问题吗?