@Override
    public void run() {
        mainLoop:
        while (true) {
            // update running status
            for (int i = 0; i < maxClients; i++) {
                running[i] = listeners[i].clientRunning();
                success[i] = listeners[i].success();
            }

            boolean tmp = true;
            // check running status
            int succ = 0;
            for (int i = 0; i < maxClients; i++) {
                if (running[i]) {
                    tmp = true;
                    break;
                } else {
                    tmp = false;
                    if(success[i]){
                        succ++;
                    }
                }
            }
            if (!tmp) {
                // Everything finished running
                elapsed = System.currentTimeMillis() - start;
                System.out.println("Sent " + maxPackets * maxClients + " packets in " + elapsed + "ms");
                System.out.println("Connections: " + succ + " succeeded, " + (maxClients-succ) + " failed.");
                break;
            }
            try {
                Thread.sleep(5);
            } catch (InterruptedException ie) {
            }
        }
    }