def test_prepareConnectionCalledWhenServiceStarts(self):
        """
        The C{prepareConnection} callable is called after
        L{ClientService.startService} once the connection is made.
        """
        prepares = [0]

        def prepareConnection(_proto):
            prepares[0] += 1

        cq, service = self.makeReconnector(prepareConnection=prepareConnection,
                                           startService=True)
        self.assertEqual(1, prepares[0])

        The C{prepareConnection} callable is called after
        L{ClientService.startService} once the connection is made.
        
stackoverflow/venv/lib/python3.6/site-packages/twisted/application/test/test_internet.py