示例#1
0
 def test_client_ping(self):
     """
     Ensure the function from client module pings correctly.
     """
     daemon = client.ensure_client_daemon()
     response = client.ping(daemon.get_port())
     self.assertIsNotNone(response)
     self.assertEqual(EventResponse.OK, response.status,
                      'Wrong response status.')
示例#2
0
def ping_client(port, reqcbk=None, timeout=1000):
    """
    Ping a client running in C{port}.

    :param port: the port in which the client should be listening
    :type port: int
    :param reqcbk: a callback to be called when a response from client is
                   received
    :type reqcbk: function(proto.PingRequest, proto.EventResponse)
    :param timeout: the timeout for synch calls
    :type timeout: int
    """
    return client.ping(port, reqcbk=reqcbk, timeout=timeout)