Example #1
0
  public static void main(String[] args) throws IOException {
    try {
      int port = Integer.valueOf(args[1]);
      int numMsgs = Integer.valueOf(args[2]);
      boolean result = false;

      if ("send".equalsIgnoreCase(args[0])) {
        Send send = new Send("localhost", port, numMsgs);
        Reactor r = Proton.reactor(send);
        r.run();
        result = send.getResult();
      } else {
        Reactor r = Proton.reactor(new Recv(port, numMsgs));
        r.run();
        result = true;
      }
      System.exit(result ? 0 : 1);
    } catch (Throwable t) {
      t.printStackTrace();
      System.exit(1);
    }
  }