@Override
    public void run() {
        int n = 0;
        while (!isBound() && n < 10) {
            WebServer.logInfo("Waiting for Socket on port " + this.getLocalPort() + " to bind");
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
            }
            n++;
        }
        if (!isBound()) {

            throw new JServeException(new SocketException("Socket failed to bind after 10 seconds"));

        }
        WebServer.logInfo("Thread Registered for port " + getLocalPort());
        while (WebServer.getStatus() == ServerStatus.Started || WebServer.getStatus() == ServerStatus.Starting) {

            // If the socket was closed (no more sites using it), then stop the thread
            if (isClosed()) {
                return;
            }

            // The Socket Object that represents the raw connection of the next connection
            Socket client;

            // Block until a new connection arrives
            try {
                client = accept();
            } catch (IOException e) {
                WebServer.logError("Accept Failed on Socket for socket on port " + getLocalPort() + ": " + e.getMessage());
                continue;
            }

            // Create a Request object for this connection
            Request req = new Request(client);

            //Create thread for the request
            Thread requestThread = new Thread(req);

            WebServer.logInfo("Starting New Thread For Request " + req.getRequestID());

            //Start thread
            requestThread.start();

        }

        // Exiting the thread
        WebServer.logInfo("Thread Exit for port " + getLocalPort() + " Server Status = " + WebServer.getStatus());

    }