示例#1
0
        public static void main(String[] args)
        {
            String         props;
            ProtocolTester t;
            Harness        h;
            boolean        trace=false;

            if(args.length < 1 || args.length > 2)
            {
                Console.WriteLine("ProtocolTester <protocol stack spec> [-trace]");
                return;
            }
            props=args[0];

            try
            {
                h=new Harness();
                t=new ProtocolTester(props, h);
                Console.WriteLine("protocol specification is " + t.getProtocolSpec());
                h.down(new Event(Event.BECOME_SERVER));
                for(int i=0; i < 5; i++)
                {
                    Console.WriteLine("Sending msg #" + i);
                    h.down(new Event(Event.MSG, new Message(null, null, "Hello world #" + i)));
                }
                Util.sleep(500);
                t.stop();
            }
            catch(Exception ex)
            {
                System.err.println(ex);
            }
        }