1 package org.opensrf.test;
3 import org.opensrf.net.xmpp.XMPPReader;
4 import org.opensrf.net.xmpp.XMPPMessage;
5 import org.opensrf.net.xmpp.XMPPSession;
7 public class TestXMPP {
9 public static void main(String args[]) throws Exception {
20 port = Integer.parseInt(args[1]);
25 } catch(ArrayIndexOutOfBoundsException e) {
26 System.err.println("usage: org.opensrf.test.TestXMPP <host> <port> <username> <password> <resource>");
30 XMPPSession session = new XMPPSession(host, port);
31 session.connect(username, password, resource);
35 if( args.length == 6 ) {
36 /** they specified a recipient */
38 msg = new XMPPMessage();
40 msg.setThread("test-thread");
41 msg.setBody("Hello, from java-xmpp");
42 System.out.println("Sending message to " + recipient);
47 System.out.println("waiting for message...");
48 msg = session.recv(-1);
49 System.out.println("got message: " + msg.toXML());