Log clear traffic with Smack 4.4.x

Hello, I’m trying to log network traffic between Smack and my XMPP server, but unfortunately I cannot have clear traffic despite settings:


while establishing a connection.
I’m using “smack-java8” and “smack-tcp” libraries.

Using old Smack version (4.3.x) these 2 configs allow to have clear traffic but with this new version of Smack start TLS anyway.

Am I forgetting something?

It should be sufficient to call SmackConfiguration.DEBUG = true, no need to disable security.
See https://github.com/igniterealtime/Smack/blob/master/documentation/debugging.md for more information on how to debug smack and view stanza traces.

Paul is right - if you can prevent the need to disable encryption, you should do that.

That said, your example should work. I’ve written this minimalistic test client. When running against a server on my localhost, I can clearly see unencrypted data be exchanged when I inspect the traffic with tcpdump -i lo port 5222 -X

pom.xml (this defines the dependency to the Smack library that I’ve used)

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">





import org.jivesoftware.smack.*;
import org.jivesoftware.smack.tcp.*;

public class TestClient {
    public static void main(String[] args) throws Exception {
        XMPPTCPConnectionConfiguration config = XMPPTCPConnectionConfiguration.builder()
                .setUsernameAndPassword("john", "secret")

        AbstractXMPPConnection conn = new XMPPTCPConnection(config);

Hi, thank you for your replies!
I’m executing my Smack client in the same way, using Java 8.
I’m able to log clear traffic at the beginning, but later Smack client send tag and logs becomes encrypted.

See the attachment for more details on the behaviour:
Smack traffic log.log (10,0 KB)

What can be wrong?
Thank you again!

StartTLS is being negotiated by your client. Have you invoked .setSecurityMode(ConnectionConfiguration.SecurityMode.disabled) on the configuration object that you’re using to set up the connection? I assume that this will prevent StartTLS from being started.

Thank you again for your patience, I’ve found the problem.
In my test project there was two Xmpp clients: the second one caused encrypted traffic.

I’m now able to log clear traffic with both Smack versions, 4.3.x and 4.4.x!

This topic was automatically closed 62 days after the last reply. New replies are no longer allowed.