def done(result): client.pending_tests -= 1 client.recv_ok += 1 if client.pending_tests == 0: client.test_done("ok") elif (client.recv_ok % 2) == 0: # keep sending messages for a while send_message()
def dummy(client): orig_connectionLost = self.protocols[0].peer.connectionLost def connectionLost(reason): """Catch disconnect and force a ConnectionLost.""" orig_connectionLost(failure.Failure(txerror.ConnectionDone())) d.callback(None) self.patch(self.protocols[0].peer, 'connectionLost', connectionLost) self.service.factory.protocols[0].shutdown() client.test_done('ok')
def dummy(client): # patch ProxyServer.connectionLost orig_connectionLost = self.protocols[0].connectionLost def connectionLost(reason): """Catch disconnect and force a ConnectionLost.""" orig_connectionLost(txerror.ConnectionLost()) d.callback(None) self.patch(self.protocols[0], 'connectionLost', connectionLost) client.kill() # kill the client and trigger a connection lost client.test_done('ok')
def dummy(client): orig_connectionLost = self.protocols[0].peer.connectionLost def connectionLost(reason): """Catch disconnect and force a ConnectionLost.""" orig_connectionLost(failure.Failure(txerror.ConnectionDone())) d.callback(None) self.patch( self.protocols[0].peer, 'connectionLost', connectionLost) self.service.factory.protocols[0].shutdown() client.test_done('ok')
def dummy(client): client.test_done("ok")
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')
def done(result): client.test_done("ok")
def done(result): self.assert_(result.rtt < 2) client.test_done("ok")
def my_connection_lost(reason=None): """ check if we received a ping and finish the test. """ client.__class__.connectionLost(client, reason) self.assertEqual(getattr(self._state, 'pings', 0), 1) client.test_done('ok')
def dummy(client): client.test_done('ok')