Hi, When i try to connect XMPP using 5222/5223 port i am getting the following error.
javax.net.ssl.SSLHandshakeException: Remote host closed connection during handshake
at sun.security.ssl.SSLSocketImpl.readRecord(Unknown Source)
at sun.security.ssl.SSLSocketImpl.performInitialHandshake(Unknown Source)
at sun.security.ssl.SSLSocketImpl.writeRecord(Unknown Source)
at sun.security.ssl.AppOutputStream.write(Unknown Source)
at sun.nio.cs.StreamEncoder.writeBytes(Unknown Source)
at sun.nio.cs.StreamEncoder.implFlushBuffer(Unknown Source)
at sun.nio.cs.StreamEncoder.implFlush(Unknown Source)
at sun.nio.cs.StreamEncoder.flush(Unknown Source)
at java.io.OutputStreamWriter.flush(Unknown Source)
at java.io.BufferedWriter.flush(Unknown Source)
at org.jivesoftware.smack.PacketWriter.openStream(PacketWriter.java:258)
at org.jivesoftware.smack.PacketWriter.writePackets(PacketWriter.java:186)
at org.jivesoftware.smack.PacketWriter.access$000(PacketWriter.java:40)
at org.jivesoftware.smack.PacketWriter$1.run(PacketWriter.java:76)
Caused by: java.io.EOFException: SSL peer shut down incorrectly
at sun.security.ssl.InputRecord.read(Unknown Source)
… 14 more
Code :
config = new ConnectionConfiguration(xmppHost,
xmppSecurePort , “”);
config.setSecurityMode(ConnectionConfiguration.SecurityMode.enabled);
config.setSocketFactory(new SSLProtocolSocketFactory());
config.setDebuggerEnabled(true);
config.setSASLAuthenticationEnabled(true);
Could any one suggest me what might be causing this issue?
Note : When i comment config.setSocketFactory(new SSLProtocolSocketFactory()); line of code it works fine with 5222 port and it treated as not secure connection. My requirement is to make the XMPP secure connection.