@Override
    public void run() {
        if(this.isValid()){
            while(blnRepeat){
                try {
                    Object readObject = inStream.readObject();
                    if(readObject instanceof IMessage){
                        IMessage msg = (IMessage)readObject;
                        switch(msg.getMessageType()){
                            case CONNECT:
                                break;
                            case CLOSECONNECTION:
                                blnRepeat = false;
                                conn.close();
                                break;
                        }
                    }
                } catch (IOException | ClassNotFoundException ex) {
                    Logger.getLogger(MiningBuddyConnection.class.getName()).log(Level.SEVERE, null, ex);
                }
            }
        }
    }