def test_requestBodyDefaultTimeout(self):
"""
L{HTTPChannel}'s default timeout is 60 seconds.
"""
clock = Clock()
transport = StringTransport()
factory = http.HTTPFactory()
protocol = factory.buildProtocol(None)
# This is a terrible violation of the abstraction later of
# _genericHTTPChannelProtocol, but we need to do it because
# policies.TimeoutMixin doesn't accept a reactor on the object.
# See https://twistedmatrix.com/trac/ticket/8488
protocol._channel.callLater = clock.callLater
protocol.makeConnection(transport)
protocol.dataReceived(b'POST / HTTP/1.0\r\nContent-Length: 2\r\n\r\n')
clock.advance(59)
self.assertFalse(transport.disconnecting)
clock.advance(1)
self.assertTrue(transport.disconnecting)
评论列表
文章目录