@Override
    public void run() {
        ObjectInputStream in = null;
        ObjectOutputStream out = null;
        try {
            in = new ObjectInputStream(this.socket.getInputStream());
            out = new ObjectOutputStream(this.socket.getOutputStream());
        } catch (IOException e) {
            e.printStackTrace();
        }
        try {
            while (true) {
                // If there is something to send, send it.
                if (!this.sendables.isEmpty()) {
                    Message output = this.sendables.remove();
                    if (this.Debug) {
                       System.out.println("Sending" + output);
                    }
                    out.writeObject(output);
                    out.flush();
                }
                // If there is something to read, read it, then go to the HandleRequest function
                if (this.socket.getInputStream().available() > 0) {
                    Message line = (Message) in.readObject();   
                    if (line.equals(null)) {
                        break;
                    }
                    else {
                        HandleRequest(line);
                    }
                    if (this.Debug) {
                        System.out.println("Received" + line);
                    }
                }
            }
            out.close();
            in.close();
            this.socket.close();
            } catch (IOException e) {
                e.printStackTrace();
            } catch (Throwable e) {
                e.printStackTrace();
            }
    }