public static void main(String[] args) throws Exception {

        if (args.length < 1) {
            System.err.println("Usage: java " + SSLJioClient.class.getName() + " URL [n] [delay]");
            System.err.println("\tURL: The url of the service to test.");
            System.err.println("\tn: The number of clients. (default is " + NB_CLIENTS + ")");
            System.err.println("\tdelay: The delay between writes. (default is " + DEFAULT_DELAY + "ms)");
            System.exit(1);
        }

        URL strURL = new URL(args[0]);
        int delay = DEFAULT_DELAY;

        if (args.length > 1) {
            try {
                NB_CLIENTS = Integer.parseInt(args[1]);
                if (args.length > 2) {
                    delay = Integer.parseInt(args[2]);
                    if (delay < 1) {
                        throw new IllegalArgumentException("Negative number: delay");
                    }
                }
            } catch (Exception exp) {
                System.err.println("Error: " + exp.getMessage());
                System.exit(1);
            }
        }

        System.out.println("\nRunning test with parameters:");
        System.out.println("\tURL: " + strURL);
        System.out.println("\tn: " + NB_CLIENTS);
        System.out.println("\tdelay: " + delay);


        String home = System.getProperty("user.home") + File.separatorChar;
        System.setProperty("javax.net.ssl.trustStore", home + "cacerts.jks");
        System.setProperty("javax.net.ssl.trustStorePassword", "changeit");
        System.setProperty("javax.net.ssl.keyStore", home + ".keystore");
        System.setProperty("javax.net.ssl.keyStorePassword", "bismillah");


        Thread clients[] = new Thread[NB_CLIENTS];

        for (int i = 0; i < clients.length; i++) {
            clients[i] = new SSLJioClient(strURL, delay);
        }

        for (int i = 0; i < clients.length; i++) {
            clients[i].start();
        }

        for (int i = 0; i < clients.length; i++) {
            clients[i].join();
        }
    }