XMPP BOSH clients don't receive each other's messages


I started today learning about XMPP BOSH and the Smack API.

I tried to create two simple client running at localhost:

  • client1: acting as a sender and having the name sender;
  • client2: acting as a receiver and having the name receiver;

The are both connected to a remote server with a given server_ip (e.g. and *server_port *(7070).

Both clients use:

  • ** BOSHConfiguration** and XMPPBOSHConnection;
  • Their StanzaListener and **StanzaListener **simple implementation for tracing incoming stanzas;
  • They use smack-core and **smack-bosh 4.1.4 **as maven dependecies.

The sender:

  • Successfully connects to the server;
  • Sends the message to receiver@
  • I perfectly monitor the packets sent by client1 to the server;
  • I saw a 401 error for each message:

The receiver:

  • Doesn’t receive nothing at all.

A snippet:

BOSHConfiguration boshConfiguration = BOSHConfiguration.builder().setUsernameAndPassword(properties.getProperty(“send er”), properties.getProperty(“password”))








XMPPBOSHConnection boshConnection = new XMPPBOSHConnection(boshConfiguration);

try {


boshConnection.addAsyncStanzaListener(new StanzaListener() {


public void processPacket(Stanza stanza) throws NotConnectedException {

logger.info(“New stanza received {}.”, stanza);


}, new StanzaFilter() {


public boolean accept(Stanza stanza) {

logger.info(“Filtering new stanza {}.”, stanza);

return stanza.getTo().contains(“sender”);



Message message = new Message("receiver@");


} catch(…){