Here are the examples of the python api twisted.web.client.handle_PING taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
1 Examples
0
Example 1
Project: filesync-server Source File: test_basic.py
def test_no_response_server_ping(self):
"""test that the client is disconnected when there is no response
to a server ping.
"""
def auth(client):
def handle_PING(message):
""" don't reply to the ping, just save each request. """
pings = getattr(self._state, 'pings', 0)
self._save_state('pings', pings + 1)
client.handle_PING = handle_PING
def my_connection_lost(reason=None):
""" check if we received a ping and finish the test. """
client.__class__.connectionLost(client, reason)
self.assertEquals(getattr(self._state, 'pings', 0), 1)
client.test_done('ok')
client.connectionLost = my_connection_lost
d = self.callback_test(auth)
return d