def test_cancel(self):
"""
When cancelling the L{Deferred} returned by L{client.readBody}, the
connection to the server will be aborted.
"""
response = DummyResponse()
deferred = client.readBody(response)
deferred.cancel()
self.failureResultOf(deferred, defer.CancelledError)
self.assertTrue(response.transport.aborting)
评论列表
文章目录