@Override
    public void run() {
        try {
            this.client.setSoTimeout(30 * 1000);
            input = new BufferedReader(new InputStreamReader(
                    client.getInputStream()));
            output = new PrintWriter(client.getOutputStream());
        }
        catch (Exception e) {
            PopServer.logger.error(e);
        }
        
        PopServer.logger.debug("Connection with the client " + 
                client.getInetAddress().getHostAddress() + " created");
        
        //Send hello info to the client
        this.writeToClient("+OK Welcome to wt-mail Pop3 Server");
        
        //Initial with Auth state
        receiver = new PopReceiver(new AuthState());
        
        while(true) {
            try {
                String inStr = input.readLine();
                
                this.receiver.handleInput(this, inStr);

                if (client == null)
                    break;
            }
            catch (SocketTimeoutException e) {
                //Connection timeout
                PopServer.logger.error(e);
                break;
            }
            catch (Exception e) {
                PopServer.logger.error(e);
                break;
            }
        }
        this.closeConnection();
    }