//config.setDebuggerEnabled(true);
//
XMPPConnection consumerCon = new XMPPConnection(config);
consumerCon.connect();
consumerCon.login("consumer", "consumer");
MultiUserChat consumerMuc = new MultiUserChat(consumerCon, "muc-test");
consumerMuc.join("consumer");
ConsumerMUCMessageListener listener = new ConsumerMUCMessageListener();
consumerMuc.addMessageListener(listener);
XMPPConnection producerCon = new XMPPConnection(config);
producerCon.connect();
producerCon.login("producer", "producer");
MultiUserChat producerMuc = new MultiUserChat(producerCon, "muc-test");
producerMuc.join("producer");
for (int i = 0; i < 10; i++) {
System.out.println("Sending message: " + i);
Message message = producerMuc.createMessage();
message.setBody("Hello from producer, message # " + i);
producerMuc.sendMessage(message);
}
System.out.println("Sent all messages!");
Thread.sleep(sleepTime);
System.out.println("Consumer received - " + listener.getMessageCount());