@Override
        public void run() {
            enabled = true;
            while (enabled) {
                try {
                    Object o = NetClient.this.inputStream.readObject();
                    if (!enabled) {
                        NetClient.this.logger.log(
                                "object received but listening from server disabled",
                                ConsoleLogger.Type.INFO);
                        return;
                    }
                    
                    if (o instanceof Message) {
                        Message msg = (Message)o;
                        if (o.equals(Message.DISCONNECT)) {
                            NetClient.this.disconnect();
                        }
                        if (msg.equalsIgnoreData(Message.ACCESS_DENIED)) {
                            NetClient.this.disconnect();
                        }
                        NetClient.this.messageReceived(msg);
                    } else {
                        NetClient.this.logger.log(
                                "non message type received from server",
                                ConsoleLogger.Type.WARNING);
                    }
                } catch (ClassNotFoundException | IOException ex) {
                    if (!enabled && ex instanceof SocketException &&
                            ex.getMessage().equalsIgnoreCase("socket closed")) {
                        NetClient.this.logger.log(
                                "listening from server stopped",
                                ConsoleLogger.Type.INFO);
                        return;
                    } else {
                        NetClient.this.logger.log(
                                "error during reading object from server",
                                ConsoleLogger.Type.ERROR);
                        ex.printStackTrace(System.err);
                    }
                }
            }
        }