public void serve() throws IOException {
        while (true) {
            // block until a client connects
            Socket socket = serverSocket.accept();
            synchronized(numClients){
                numClients++;
            }
            // handle the client by creating a new ClientThread object and calling runHandleInThread
            ClientThread client = new ClientThread(socket);
            client.runHandleInThread();
        }
    }