示例#1
0
    def _process_info(self, info):
        '''\
        process server infomation message;

        Params:
        =====
        info: nats server information
        '''
        server_info = json.loads(info)
        if server_info["auth_required"]:
            conn_opts = self.conn.get_connection_options()
            self.conn.send_command(Protocol.connect_command(conn_opts), True)
示例#2
0
    def _process_info(self, info):
        '''\
        process server infomation message;

        Params:
        =====
        info: nats server information
        '''
        server_info = json.loads(info)
        if server_info["auth_required"]:
            conn_opts = self.conn.get_connection_options()
            self.conn.send_command(Protocol.connect_command(conn_opts),
                True)
示例#3
0
 def test_connect_command(self):
     'should return the connect command'
     opts = {'user': '******', 'pass': '******'}
     self.assertEqual(Protocol.connect_command(opts),
                      'CONNECT {"user": "******", "pass": "******"}\r\n')
示例#4
0
 def test_connect_command(self):
     'should return the connect command'
     opts = {'user' : 'a', 'pass' : 'b'}
     self.assertEqual(Protocol.connect_command(opts), 
      	'CONNECT {"user": "******", "pass": "******"}\r\n')