def test_stopServiceWhileRestarting(self):
"""
Calling L{ClientService.stopService} after calling a
reconnection attempt returns a L{Deferred} that fires when the
disconnection has completed.
"""
clock = Clock()
cq, service = self.makeReconnector(fireImmediately=False,
clock=clock)
# The protocol connects
cq.connectQueue[0].callback(None)
# The protocol begins disconnecting
firstStopDeferred = service.stopService()
# The protocol begins reconnecting
service.startService()
# The protocol begins disconnecting again
secondStopDeferred = service.stopService()
# The protocol is disconnected
cq.constructedProtocols[0].connectionLost(Failure(IndentationError()))
self.successResultOf(firstStopDeferred)
self.successResultOf(secondStopDeferred)
评论列表
文章目录