public void run(){

        try {

            String response;
            this.write("NEW " + user);
            if(this.read().equals("OK")){
                
                while (! isInterrupted()) {
                    this.write("INFO");
                    response = this.read();
                    
                    if(response.startsWith("ERROR")){
                        break;
                    }else if(response.startsWith("LIST")){
                        this.hostList = new HashSet<String>();
                        this.userList = new ArrayList<String>();
                        String user = "";
                        String[] splited = response.substring(7).split(" ");
                        for(Integer i=0; i<splited.length; i++){
                            if(i%2 == 0){
                                this.hostList.add(splited[i]);
                            }else{
                                user += splited[i] + "\n";
                                this.userList.add(splited[i]);
                            }
                        }
                        this.chat.setUsers(user);
                    }

                    try {
                        this.sleep(5000);
                        
                    } catch (InterruptedException e) {
                        interrupt();
                    }
                }
            }
            this.write("BYE");
            this.read();
            this.socket.close();
            System.exit(0);
        } catch (IOException e) {}
    }