def test_connectConnectedReconnect(self):
        self.setUpState('connected')

        # Try to connect.
        self.monitor.connect(forceReconnect=True)

        # As we haven't connected yet, we cannot drop the connection yet,
        # and no reconnect should have taken place.
        self.clock.advance(DELAY_INITIAL)
        self.assertEqual(1, len(self.api.filterCalls))

        # A disconnect occurs right away.
        self.clock.advance(0)
        self.assertTrue(self.api.protocol.stopCalled)
        self.api.protocol.connectionLost(failure.Failure(ResponseDone()))
        self.clock.advance(0)

        # Now the reconnect occurs, wait for delayed calls.
        self.clock.advance(DELAY_INITIAL)
        self.assertEqual(2, len(self.api.filterCalls))
Reconnect while connected.
dataset/ETHPy150Open dustin/twitty-twister/twittytwister/test/test_twitter.py/TwitterMonitorTest.test_connectConnectedReconnect