public Message receiveOneMessage(){
        NetObject ret = null;
        if(type == Type.SERVER){
            ret = server.listen();
        } else if (type == Type.CLIENT) {
            ret = client.listen();
        }
        // Ignore not DATA network packet
        if(ret.type != NetObject.NetType.DATA){
            System.out.println("Not receiving data");
            return null;
        }

        Message msg = null;
        try {
            msg = (Message) Message.deserialize(ret.data);
        } catch (IOException e) {
            System.err.println("Fail to deserialize: " + e.getMessage());
        } catch (ClassNotFoundException e) {
            System.err.println("Fail find class: " + e.getMessage());
        }

        return msg;
    }