public static void main(String[] args) throws Exception {
        String props="udp.xml";
        String name=null;

        for(int i=0; i < args.length; i++) {
            if(args[i].equals("-props")) {
                props=args[++i];
                continue;
            }
            if(args[i].equals("-name")) {
                name=args[++i];
                continue;
            }
            System.out.println("RelayDemo [-props props] [-name name]");
            return;
        }

        final JChannel ch=new JChannel(props);
        if(name != null)
            ch.setName(name);
        ch.setReceiver(new ReceiverAdapter() {
            public void receive(Message msg) {
                Address sender=msg.getSrc();
                System.out.println("<< " + msg.getObject() + " from " + sender);
                Address dst=msg.getDest();
                if(dst == null) {
                    Message rsp=new Message(msg.getSrc(), "this is a response");
                    try {
                        ch.send(rsp);
                    }
                    catch(Exception e) {
                        e.printStackTrace();
                    }
                }
            }

            public void viewAccepted(View new_view) {
                System.out.println(print(new_view));
            }
        });

        ch.connect("RelayDemo");

        for(;;) {
            String line=Util.readStringFromStdin(": ");
            ch.send(null, line);
        }
    }