Can't receive/send messages to OpenFire server across smack api

Hi!

I have own configured openfire server. I have created two users user1 and user2 and I’m trying to send/receive messages between this users across the smack api.

I switched on debug mode in smack api and can see that my dummy application sends and receives messages, but MessageListener doesn’t work, it never invokes processMessage(Chat chat, Message message) method, also I can’t see messages in the miranda IM client of the user2.

public class Main {

public static void main(String[] args) throws XMPPException, InterruptedException {

sendJabberMessage();

while (true) {

Thread.sleep(50);

}

}

public static void sendJabberMessage() throws XMPPException {

XMPPConnection.DEBUG_ENABLED = true;

ConnectionConfiguration config = new ConnectionConfiguration(“ejab.net”, 5222, “ejab.net”);

SASLAuthentication.supportSASLMechanism(“PLAIN”, 0);

config.setCompressionEnabled(true);

config.setSASLAuthenticationEnabled(true);

XMPPConnection connection = new XMPPConnection(config);

connection.connect();

connection.login(“user1”, “password”);

    Chat chat = connection.getChatManager().createChat("user2@ejab.net.ru", new MessageListener() {

public void processMessage(Chat chat, Message message) {

System.out.println("Received message: " + message);

}

});

}

Here is my debug logs:

Sent log

<stream:stream to="ejab.net" xmlns="jabber:client" xmlns:stream="[http://etherx.jabber.org/streams](http://etherx.jabber.org/streams)" version="1.0">
<stream:stream to="ejab.net" xmlns="jabber:client" xmlns:stream="[http://etherx.jabber.org/streams](http://etherx.jabber.org/streams)" version="1.0">

b3BlcmF0b3IyQGVqYWIubmV0AG9wZXJhdG9yMk BlamFiLm5ldAA4ZGRYUGdQYTU0MlQ=

<stream:stream to="ejab.net" xmlns="jabber:client" xmlns:stream="[http://etherx.jabber.org/streams](http://etherx.jabber.org/streams)" version="1.0">

Smack

<compress xmlns='[http://jabber.org/protocol/compress](http://jabber.org/protocol/compress)'>

zlib

<stream:stream to="ejab.net" xmlns="jabber:client" xmlns:stream="[http://etherx.jabber.org/streams](http://etherx.jabber.org/streams)" version="1.0">

<message id="4KApN-4" to="user1@ejab.net.ru" from="user2@ejab.net/Smack" type="chat"><body>Hello world</body><thread>T0T5u0</thread></message>

<iq id="mir_148" to="user1@ejab.net/Miranda" type="result"><query xmlns="[http://jabber.org/protocol/disco#info](http://jabber.org/protocol/disco#info)"><identity category="client" name="Smack" type="pc"/><feature var="[http://jabber.org/protocol/xhtml-im](http://jabber.org/protocol/xhtml-im)"/><feature var="[http://jabber.org/protocol/muc](http://jabber.org/protocol/muc)"/><feature var="[http://jabber.org/protocol/commands](http://jabber.org/protocol/commands)"/></query></iq>

Received log

<?xml version='1.0' encoding='UTF-8'?><stream:stream xmlns:stream="[http://etherx.jabber.org/streams](http://etherx.jabber.org/streams)" xmlns="jabber:client" from="ejab.net" id="4942adbf" xml:lang="en" version="1.0"><stream:features><starttls xmlns="urn:ietf:params:xml:ns:xmpp-tls"><required/></starttls><mechanisms xmlns="urn:ietf:params:xml:ns:xmpp-sasl"><mechanism>DIGEST-MD5</mechanism><mech anism>JIVE-SHAREDSECRET</mechanism><mechanism>PLAIN</mechanism><mechanism>ANONYM OUS</mechanism><mechanism>CRAM-MD5</mechanism></mechanisms></stream:features>
<?xml version='1.0' encoding='UTF-8'?><stream:stream xmlns:stream="[http://etherx.jabber.org/streams](http://etherx.jabber.org/streams)" xmlns="jabber:client" from="ejab.net" id="4942adbf" xml:lang="en" version="1.0"><stream:features><mechanisms xmlns="urn:ietf:params:xml:ns:xmpp-sasl"><mechanism>DIGEST-MD5</mechanism><mech anism>JIVE-SHAREDSECRET</mechanism><mechanism>PLAIN</mechanism><mechanism>ANONYM OUS</mechanism><mechanism>CRAM-MD5</mechanism></mechanisms><compression xmlns="[http://jabber.org/features/compress](http://jabber.org/features/compress)"><method>zlib</method></compression><auth xmlns="[http://jabber.org/features/iq-auth](http://jabber.org/features/iq-auth)"/><register xmlns="[http://jabber.org/features/iq-register](http://jabber.org/features/iq-register)"/></stream:features>
<?xml version='1.0' encoding='UTF-8'?><stream:stream xmlns:stream="[http://etherx.jabber.org/streams](http://etherx.jabber.org/streams)" xmlns="jabber:client" from="ejab.net" id="4942adbf" xml:lang="en" version="1.0"><stream:features><compression xmlns="[http://jabber.org/features/compress](http://jabber.org/features/compress)"><method>zlib</method></compression><bind xmlns="urn:ietf:params:xml:ns:xmpp-bind"/><session xmlns="urn:ietf:params:xml:ns:xmpp-session"/></stream:features>

<iq type="result" id="4KApN-0" to="ejab.net/4942adbf"><bind xmlns="urn:ietf:params:xml:ns:xmpp-bind"><jid>user2@ejab.net/Smack</jid></bind></iq>

<iq type="result" id="4KApN-1" to="user2@ejab.net/Smack"><session xmlns="urn:ietf:params:xml:ns:xmpp-session"/></iq>

<compressed xmlns='[http://jabber.org/protocol/compress'/](http://jabber.org/protocol/compress'/)>

<?xml version='1.0' encoding='UTF-8'?><stream:stream xmlns:stream="[http://etherx.jabber.org/streams](http://etherx.jabber.org/streams)" xmlns="jabber:client" from="ejab.net" id="4942adbf" xml:lang="en" version="1.0"><stream:features><bind xmlns="urn:ietf:params:xml:ns:xmpp-bind"/><session xmlns="urn:ietf:params:xml:ns:xmpp-session"/></stream:features>

<iq type="result" id="4KApN-2" to="user2@ejab.net/Smack"><query xmlns="jabber:iq:roster"><item jid="user1@ejab.net" name="user1" subscription="both"/></query></iq>

<presence from="user1@ejab.net/Miranda" to="user2@ejab.net/Smack"><priority>0</priority><c xmlns="[http://jabber.org/protocol/caps](http://jabber.org/protocol/caps)" node="[http://miranda-im.org/caps](http://miranda-im.org/caps)" ver="0.9.28.0" ext="pmuc-v1 mood activity mir_notes"/><x xmlns="vcard-temp:x:update"><photo/></x><status>Yep, I'm here.</status></presence>

<iq type="get" to="user2@ejab.net/Smack" id="mir_147" from="user1@ejab.net/Miranda"><query xmlns="jabber:iq:version"/></iq>

<iq type="get" to="user2@ejab.net/Smack" id="mir_148" from="user1@ejab.net/Miranda"><query xmlns="[http://jabber.org/protocol/disco#info](http://jabber.org/protocol/disco#info)"/></iq>

<message type="chat" to="user2@ejab.net/Smack" id="mir_151" from="user1@ejab.net/Miranda"><body>TEST</body></message>

Can somebody help me and say why my client doesn’t prints incomimming messages on console, and why user2 doesn’t receive messages; Logs doesn’t contain any errors.