'L{ClientService.whenConnected} returns a L{Deferred} that fails when
L{ClientService.stopService} is called.'

def test_whenConnectedStopService(self):

    clock = Clock()
    (cq, service) = self.makeReconnector(fireImmediately=False, clock=clock)
    a = service.whenConnected()
    b = service.whenConnected()
    c = service.whenConnected(failAfterFailures=1)
    self.assertNoResult(a)
    self.assertNoResult(b)
    self.assertNoResult(c)
    service.stopService()
    clock.advance(AT_LEAST_ONE_ATTEMPT)
    self.failureResultOf(a, CancelledError)
    self.failureResultOf(b, CancelledError)
    self.failureResultOf(c, CancelledError)
