public static void main(String[] args) throws IOException {
        if (args.length < 2 || args.length > 3) {
            System.out.println("Usage:");
            System.out.println("   {hostname} {port} [{threadCount}]");
            System.exit(0);
        }

        // where to listen...?
        String host = args[0];
        int port = Integer.parseInt(args[1]);

        // create the SOCKS4 handler and the (NIO) server
        SOCKS4 socks4 = new SOCKS4();
        PyroServer server = createProxyServer(socks4, host, port);
        System.out.println("launched SOCKS4 server: " + server);

        if (args.length == 3) {
            // how many networking threads on the pool...?
            int selectorCount = Integer.parseInt(args[2]);
            if (selectorCount < 1)
                throw new IllegalStateException();

            // make traffic-selector pool
            PyroSelector[] pool = new PyroSelector[selectorCount];
            for (int i = 0; i < pool.length; i++) {
                pool[i] = new PyroSelector(socks4);

                // launch the threads that will handle network I/O (1 NIO
                // selector per thread)
                pool[i].spawnNetworkThread("traffic-thread #" + (i + 1));
            }

            PyroSelectorProvider roundrobin = new PyroRoundrobinSelectorProvider(
                    pool);
            server.installSelectorProvider(roundrobin);
        }

        // pick your favorite
        if (Math.random() < 0.5) {
            System.out.println("going to spawn a new thread for network I/O");
            server.selector().spawnNetworkThread("socks4-handler");
        } else {
            System.out
                    .println("going to use the current thread for network I/O");
            while (true) {
                server.selector().select();
            }
        }
    }