Thank you for your reply.
But the problem is still make me trouble. I have tried similar code like yours before, below is my latest login code (the same to yours):
public static void main(String[] args) throws XMPPException {
ConnectionConfiguration config = new ConnectionConfiguration(“talk.google.com”,5222,“gmail.com”);
XMPPConnection connection = new XMPPConnection(config);
config.setSASLAuthenticationEnabled(false);
connection.connect();
connection.login("vwyangwei@gmail.com", password);
System.out.println(connection.isAuthenticated());
}
The raw Console output is:
javax.net.ssl.SSLKeyException: RSA premaster secret error
at com.sun.net.ssl.internal.ssl.RSAClientKeyExchange.(Unknown Source)
at com.sun.net.ssl.internal.ssl.ClientHandshaker.serverHelloDone(Unknown Source)
at com.sun.net.ssl.internal.ssl.ClientHandshaker.processMessage(Unknown Source)
at com.sun.net.ssl.internal.ssl.Handshaker.processLoop(Unknown Source)
at com.sun.net.ssl.internal.ssl.Handshaker.process_record(Unknown Source)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(Unknown Source)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.performInitialHandshake(Unknown Source)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake(Unknown Source)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake(Unknown Source)
…
This puzzled me, you can using the same code to connect to gtalk successful, and I can get ping reply from gtalk server too, but an entirely different conclusion come to me, have you changed your google account setting about the SSL connection?
In the mean time, I using the code upon to connect my openfire server( turn off the tls ), the result is: “Exception in thread “main” not-authorized(401)”
I changed the code like “config.setSASLAuthenticationEnabled(true);” , it works.
When the tls on openfire is on , both the true or false setting is invalid.
I googled the problem, found that not a little people sharing the same problem like me —following the sample on smack manual, tried to connect gtalk or jabber server , finally come to the RSA error— and nobody can slove it, I hope the development team can update the sample or explain the problem.
Maybe I talked too much, thanks again for your kindness reply.