'If a L{ReconnectingClientFactory} has C{stopTrying} called while it is
connected, it does not subsequently attempt to reconnect if the
connection is later lost.'

def test_stopTryingWhenConnected(self):

    class NoConnectConnector(object, ):
        def stopConnecting(self):
            raise RuntimeError("Shouldn't    be    called,    we're    connected.")
        def connect(self):
            raise RuntimeError("Shouldn't    be    reconnecting.")
    c = ReconnectingClientFactory()
    c.protocol = Protocol
    c.buildProtocol(None)
    c.stopTrying()
    c.clientConnectionLost(NoConnectConnector(), None)
    self.assertFalse(c.continueTrying)
