XMPPConnection con = new XMPPConnection("localhost", 61222);
con.login("amq-user", "amq-pwd");
Chat chat = con.createChat("test@localhost");
for (int i = 0; i < 10; i++) {
System.out.println("Sending message: " + i);
chat.sendMessage("Hello from Message: " + i);
}
System.out.println("Sent all messages!");
} catch (XMPPException e) {
if (block) {
System.out.println("Caught: " + e);