Hello all!
This is my first post here!
I need help from you for a problem about connection between client and server. It fails most of the time. I tried to use a 30 seconds timeout to no avail.
Expected:
Connect successfully each time when TLS security mode is set to required.
*Note: No problem when security is set to ādisabledā.
Actual:
Fail like 90% of the time, and throw an exception.
*Note: I donāt know why it can connect sometime though!
Version:
Smack 4.4.5 (4.4.5-4.4 2022-03-02).
Openfire 4.1.6
Exception:
org.jivesoftware.smack.SmackException$NoResponseException
Stacktrace:
org.jivesoftware.smack.SmackException$NoResponseException: No response received within reply timeout. Timeout was 10000ms (~10s). While waiting for establishing TLS [XMPPTCPConnection[not-authenticated] (0)]
at org.jivesoftware.smack.SmackException$NoResponseException.newWith(SmackException.java:99) ~[smack-core-4.4.5.jar:4.4.5]
at org.jivesoftware.smack.AbstractXMPPConnection.waitForConditionOrConnectionException(AbstractXMPPConnection.java:729) ~[smack-core-4.4.5.jar:4.4.5]
at org.jivesoftware.smack.AbstractXMPPConnection.waitForConditionOrThrowConnectionException(AbstractXMPPConnection.java:734) ~[smack-core-4.4.5.jar:4.4.5]
at org.jivesoftware.smack.tcp.XMPPTCPConnection.connectInternal(XMPPTCPConnection.java:857) ~[smack-tcp-4.4.5.jar:4.4.5]
at org.jivesoftware.smack.AbstractXMPPConnection.connect(AbstractXMPPConnection.java:526) ~[smack-core-4.4.5.jar:4.4.5]
XMPP trace:
15:23:08 SENT (0):
<stream:stream xmlns='jabber:client' to='example.com' xmlns:stream='http://etherx.jabber.org/streams' version='1.0' xml:lang='en-US'>
15:23:08 RECV (0): ?xml version='1.0' encoding='UTF-8'?>
<stream:stream xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client" from="example.com" id="6y5wexe95i" xml:lang="en-US" version="1.0">
15:23:08 RECV (0):
<stream:features>
<starttls xmlns="urn:ietf:params:xml:ns:xmpp-tls">
</starttls>
<mechanisms xmlns="urn:ietf:params:xml:ns:xmpp-sasl">
<mechanism>
PLAIN
</mechanism>
<mechanism>
SCRAM-SHA-1
</mechanism>
<mechanism>
CRAM-MD5
</mechanism>
<mechanism>
DIGEST-MD5
</mechanism>
</mechanisms>
<compression xmlns="http://jabber.org/features/compress">
<method>
zlib
</method>
</compression>
<register xmlns="http://jabber.org/features/iq-register"/>
</stream:features>
15:23:08 SENT (0):
<starttls xmlns='urn:ietf:params:xml:ns:xmpp-tls'/>
15:23:08 RECV (0):
<proceed xmlns="urn:ietf:params:xml:ns:xmpp-tls"/>
15:23:08 SENT (0):
<stream:stream xmlns='jabber:client' to='example.com' xmlns:stream='http://etherx.jabber.org/streams' version='1.0' id='6y5wexe95i' xml:lang='en-US'>
Code:
SmackConfiguration.setDefaultReplyTimeout(10000);
SmackConfiguration.DEBUG = true;
this.tcpConnection = new XMPPTCPConnection(
XMPPTCPConnectionConfiguration.builder()
.setHostAddress(InetAddress.getByName("example.com"))
.setPort(15222)
.setXmppDomain(JidCreate.domainBareFrom("example.com"))
.setSendPresence(false)
.setCompressionEnabled(true)
.setSecurityMode(SecurityMode.required)
.build());
try
{
this.tcpConnection.connect();
}
catch (Exception ex)
{
// org.jivesoftware.smack.SmackException$NoResponseException is caught
}
- Is there some known issues about the communication between a recent version of Smack and an older Openfire version?
- Can it be something about the version of some dependencies? As far as I know, everything should be okay based on the Maven repository website (https://mvnrepository.com/).
*Note: I am not using Maven directly to manage them, I do it manually in NetBeans 13 for now.
Thank you
Jonathan
EDIT: Fixed code, there was an error. Passing āexample.comā to getByName() now.