コード例 #1
0
    def test_handshake(self):
        conn = EPMDKeepAliveConnection('test', 9999)
        conn.start()

        res = port2_please(self.erl_node_name)
        erl_port = res[1]

        channel = Channel(None)
        channel.connect(erl_port)

        node_name = self.erl_node_name + '@' + socket.gethostname()
        channel.send_name(node_name)
        self.assertEqual(channel.recv_status(), ('s', 'ok'))

        res = channel.recv_challenge()
        self.assertEqual(len(res), 5)
        self.assertEqual(res[0], 'n')

        self.assertEqual(res[4], node_name)

        out_challenge = res[3]
        challenge = gen_challenge()

        channel.send_challenge_reply(self.erl_node_secret, challenge,
                                     out_challenge)
        res = channel.recv_challenge_ack()
        self.assertEqual(len(res), 2)
        self.assertEqual(res[0], 'a')
コード例 #2
0
    def test_handshake(self):
        conn = EPMDKeepAliveConnection('test', 9999)
        conn.start()

        res = port2_please(self.erl_node_name)
        erl_port = res[1]

        channel = Channel(None)
        channel.connect(erl_port)

        node_name = self.erl_node_name + '@' + socket.gethostname()
        channel.send_name(node_name)
        self.assertEqual(channel.recv_status(), ('s', 'ok'))

        res = channel.recv_challenge()
        self.assertEqual(len(res), 5)
        self.assertEqual(res[0], 'n')

        self.assertEqual(res[4], node_name)

        out_challenge = res[3]
        challenge = gen_challenge()

        channel.send_challenge_reply(self.erl_node_secret,
                                     challenge, out_challenge)
        res = channel.recv_challenge_ack()
        self.assertEqual(len(res), 2)
        self.assertEqual(res[0], 'a')
コード例 #3
0
    def test(self):
        conn = EPMDKeepAliveConnection('test', 9999)
        conn.start()

        res = port2_please(self.erl_node_name)
        conn.join(0.1)
        self.assertEqual(len(res), 10)
        self.assertEqual(res[7], 'erl1')