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

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

    try {
      h = new Harness();
      t = new ProtocolTester(props, h);
      System.out.println("protocol specification is " + t.getProtocolSpec());
      h.down(new Event(Event.BECOME_SERVER));
      for (int i = 0; i < 5; i++) {
        System.out.println("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);
    }
  }