Пример #1
0
 public static CommandScheduler create(String cmd, long interval) {
   CommandScheduler cs = new CommandScheduler(cmd, interval);
   Client.getCommandSchedulers().add(cs);
   cs.start();
   return cs;
 }
Пример #2
0
 public void actionPerformed(ActionEvent e) {
   adaptee.jMenuItemOptionsGlobalUneavesdrop_actionPerformed(e);
 }
Пример #3
0
 public void actionPerformed(ActionEvent e) {
   adaptee.jMenuItemScheduleCommand_actionPerformed(e);
 }
Пример #4
0
 public void actionPerformed(ActionEvent e) {
   adaptee.jMenuItemTestMessageStresser_actionPerformed(e);
 }
Пример #5
0
 public void actionPerformed(ActionEvent e) {
   adaptee.jMenuItemTestMultidisconnect_actionPerformed(e);
 }
Пример #6
0
 public void actionPerformed(ActionEvent e) {
   adaptee.jToggleButtonRegister_actionPerformed(e);
 }
Пример #7
0
 public void actionPerformed(ActionEvent e) {
   adaptee.jMenuItemOptionsDeregister_actionPerformed(e);
 }
Пример #8
0
 public void actionPerformed(ActionEvent e) {
   adaptee.jMenuItemClearMessages_actionPerformed(e);
 }
Пример #9
0
 public void mouseClicked(MouseEvent e) {
   adaptee.jTextPaneDisplayMessages_mouseClicked(e);
 }
Пример #10
0
 public void keyPressed(KeyEvent e) {
   adaptee.jTextFieldSendMessages_keyPressed(e);
 }
Пример #11
0
 public void actionPerformed(ActionEvent e) {
   adaptee.jButtonMessageStresser_actionPerformed(e);
 }
Пример #12
0
 public void actionPerformed(ActionEvent e) {
   adaptee.jToggleButtonConnect_actionPerformed(e);
 }
Пример #13
0
 public void mouseClicked(MouseEvent e) {
   adaptee.jListOnlineUsers_mouseClicked(e);
 }
Пример #14
0
 public void actionPerformed(ActionEvent e) {
   adaptee.jButtonMultiConnect_actionPerformed(e);
 }
Пример #15
0
 public void actionPerformed(ActionEvent e) {
   adaptee.jMenuItemEditScheduledCommands_actionPerformed(e);
 }
Пример #16
0
 public void actionPerformed(ActionEvent e) {
   adaptee.jMenuItemServerDisconnect_actionPerformed(e);
 }
Пример #17
0
  public static void main(String[] args) {
    if (args.length > 0) {
      try {
        if (args[0].equals("-stress")) {
          String userName = args[1];
          String server = args[2];
          String targetUser = args[3];
          int rate = Integer.parseInt(args[4]);
          Session session = new Session();
          if (session.connect(server, userName)) {
            long msgCount = 0;
            while (true) {
              for (int i = 0; i < rate; i++) {
                msgCount++;
                session.postMessage(
                    targetUser, ("subject " + String.valueOf(msgCount)), Util.randomString(1000));
              }
              Thread.currentThread().sleep(2000);
            }
          }
        } else if (args[0].equals("-stress2")) {
          String userName = args[1];
          String server = args[2];
          String targetUser = args[3];
          int rate = Integer.parseInt(args[4]);
          Session session = new Session();
          long msgCount = 0;
          while (true) {
            if (session.connect(server, userName)) {
              for (int i = 0; i < rate; i++) {
                msgCount++;
                session.postMessage(
                    targetUser, ("subject " + String.valueOf(msgCount)), Util.randomString(1000));
              }
              session.disconnect();
            }
            Thread.currentThread().sleep(2000);
          }

        } else if (args[0].equals("-stress3")) {
          String userName = args[1];
          String server = args[2];
          String targetUser = args[3];
          int rate = Integer.parseInt(args[4]);
          Session session = new Session();
          long msgCount = 0;
          while (true) {
            if (session.connect(server, userName)) {
              for (int i = 0; i < rate; i++) {
                msgCount++;
                session.postMessage(
                    targetUser, ("subject " + String.valueOf(msgCount)), Util.randomString(1000));
              }
              session.dropConnection();
            }
            Thread.currentThread().sleep(2000);
          }
        } else if (args[0].equals("-stress4")) {
          String userName = args[1];
          String server = args[2];
          String targetUser = args[3];
          int rate = Integer.parseInt(args[4]);
          Session session = new Session();
          long msgCount = 0;
          while (true) {
            if (session.connect(server, userName)) {
              for (int i = 0; i < rate; i++) {
                msgCount++;
                session.postMessage(
                    targetUser, ("subject " + String.valueOf(msgCount)), Util.fixedString(300000));
              }
              session.dropConnection();
            }
            Thread.currentThread().sleep(5000);
          }

        } else if (args[0].equals("-stress5")) {
          String userName = args[1];
          String server = args[2];
          String targetUser = args[3];
          int rate = Integer.parseInt(args[4]);
          Session session = new Session();
          if (session.connect(server, userName)) {
            long msgCount = 0;
            while (true) {
              for (int i = 0; i < rate; i++) {
                msgCount++;
                session.postMessage(
                    targetUser, ("subject " + String.valueOf(msgCount)), Util.randomString(10));
              }
              Thread.currentThread().sleep(2000);
            }
          }
        } else if (args[0].equals("-monitor")) {
          String userName = args[1];
          String server = args[2];
          long interval = Long.parseLong(args[3]);
          Session session = new Session();
          long msgCount = 0;
          if (session.connect(server, userName)) {
            while (true) {
              Message msg = session.sendMessage("", "get send queue stats", "");
              System.out.println("SEND QUEUE STATS");
              System.out.println(msg.getBody());
              Thread.currentThread().sleep(interval);
            }
          }
        } else if (args[0].equals("-responder")) {
          String userName = args[1];
          String server = args[2];
          long interval = Long.parseLong(args[3]);
          final Session session = new Session();
          if (session.connect(server, userName)) {
            session.addListener(
                new AsyncMessageReceiverListener() {
                  public void receiveMsg(Message msg) {
                    session.postMessage(
                        msg.getFrom(), "RE: " + msg.getFrom(), msg.getThread(), msg.getBody());
                  }

                  public void messageReceiverClosed(MessageReceiver mr) {}
                });
            while (true) {
              Thread.currentThread().sleep(interval);
            }
          }
        } else if (args[0].equals("-threaded-sender")) {
          String userName = args[1];
          String server = args[2];
          String targetUser = args[3];
          int rate = Integer.parseInt(args[4]);
          Session session = new Session();
          long msgCount = 0;
          if (session.connect(server, userName)) {
            while (true) {
              for (int i = 0; i < rate; i++) {
                msgCount++;
                Message reply =
                    session.sendMessage(
                        targetUser, ("subject " + String.valueOf(msgCount)), "body", 10000);
                if (reply == null) {
                  System.out.println("reply not received");
                }
              }
              Thread.currentThread().sleep(5000);
            }
          }
        }
      } catch (Exception e) {
        System.out.println(
            "Unable to start stress test.  Format: -stress <user name> <server> <target user> <msg rate>");
      }
    } else {
      Client client = new Client();
      client.setSize(800, 420);
      center(client);
      client.show();
    }
  }
Пример #18
0
 public void keyPressed(KeyEvent e) {
   adaptee.jTextFieldSendSubject_keyPressed(e);
 }