@SuppressWarnings("resource")
    public void serve(int port) throws IOException {
        ServerSocket serverSocket = new ServerSocket(port);

        while (true) {
            final Socket socket = serverSocket.accept();

            Thread thread = new Thread(new Runnable() {
                @Override
                public void run() {

                    try {
                        boolean connectedToWhiteboard = false; // client has not
                                                               // yet
                                                               // successfully
                                                               // connected to a
                                                               // whiteboard
                        BufferedReader clientIn = new BufferedReader(
                                new InputStreamReader(socket.getInputStream()));
                        PrintWriter clientWriter = new PrintWriter(socket
                                .getOutputStream(), true);
                        while (!connectedToWhiteboard) {
                            String inputLine = clientIn.readLine();
                            while (inputLine == null) { // Wait for the client
                                                        // to send a message
                                inputLine = clientIn.readLine();
                            }
                            // Extract desired information from the client's
                            // message
                            String[] inputAsArray = inputLine.split(" ");
                            if (inputAsArray[0].equals("whiteboard")) {
                                if (!usernames.contains(inputAsArray[3])) {
                                    String chosenWhiteboard = inputAsArray[1];
                                    String username = inputAsArray[3];
                                    Client newClient = new Client(username,
                                            clientWriter);
                                    whiteboardMap.get(chosenWhiteboard)
                                            .addClient(newClient);
                                    usernames.add(username);

                                    Thread handleClient = new Thread(
                                            new ClientHandler(socket,
                                                    chosenWhiteboard, newClient));
                                    handleClient.start();
                                    connectedToWhiteboard = true; // client has
                                                                  // now
                                                                  // connected
                                                                  // to a
                                                                  // whiteboard
                                } else {
                                    clientWriter.println("usernameTaken");
                                }
                            }
                        }

                    } catch (IOException e) {
                        e.printStackTrace();
                    }
                }
            });

            thread.start();
        }
    }