Ejemplo n.º 1
0
 public void run() throws Exception {
   Thread[] threads = new Thread[THREADS];
   for (int i = 0; i < THREADS; i++) {
     try {
       threads[i] = new Thread(peerFactory.newClient(this), "Client " + i);
     } catch (Exception e) {
       e.printStackTrace();
       return;
     }
     threads[i].start();
   }
   try {
     for (int i = 0; i < THREADS; i++) {
       threads[i].join();
     }
   } catch (InterruptedException e) {
     setFailed();
     e.printStackTrace();
   }
   if (failed) {
     throw new Exception("*** Test '" + peerFactory.getName() + "' failed ***");
   } else {
     System.out.println("Test '" + peerFactory.getName() + "' completed successfully");
   }
 }