Take the 2-minute tour ×

I'm working on a test suite for XMPP server. Currently I have implemented a client able to connect, create account, send stanzas taken from XML file, receive the reply, store it in another file and compare that with the expected output. I can create several clients, but I'm looking for concurrent operation.

How do I go about making multiple clients to communicate with each other? My vision - put the clients into separate threads and provide commands like 'wait for reply'.

Any advice is appreciated...

share|improve this question
add comment

1 Answer

All done on same thread in a single testcase.

  • Create outgoing connection as user 1.
  • Create incoming connection as user 2.
  • Register PacketListener for your test stanza which writes to a BlockingQueue on incoming connection.
  • Write stanza on outgoing connection.
  • Call take() on the queue and test results.

Note: The PacketListener will get called on a separate thread spawned internally by Smack, which is why you need the BlockingQueue to coordinate the send and the reply.

share|improve this answer
+1 Also consider having several XMPPConnection instances each one with its own PacketListener and BlockingQueue to test message routing or multiuser chats. –  mschonaker Oct 9 '10 at 6:59
add comment

Your Answer


