код:
Код: Выделить всё
XMPPTCPConnectionConfiguration config = XMPPTCPConnectionConfiguration.builder()
.setUsernameAndPassword("testjava", "12345678")
.setServiceName(server)
.setPort(5222)
.setHost(server) .setSecurityMode(ConnectionConfiguration.SecurityMode.required)
.setDebuggerEnabled(true)
.build();
AbstractXMPPConnection conn2 = new XMPPTCPConnection(config);
conn2.connect();
Код: Выделить всё
10:35:31 AM SENT (0):
10:35:31 AM RECV (0):
10:35:32 AM RECV (0): PLAIN
10:35:32 AM SENT (0):
10:35:32 AM RECV (0):
Exception in thread "main" org.jivesoftware.smack.SmackException: javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader.parsePackets(XMPPTCPConnection.java:1010)
at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader.access$200(XMPPTCPConnection.java:937)
at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader$1.run(XMPPTCPConnection.java:952)
at java.lang.Thread.run(Thread.java:745)
Подробнее здесь: https://stackoverflow.com/questions/436 ... 0-with-tls