def test_endpointFactory(self):
        """
        L{Agent.usingEndpointFactory} creates an L{Agent} that uses the given
        factory to create endpoints.
        """
        factory = StubEndpointFactory()
        agent = client.Agent.usingEndpointFactory(
            None, endpointFactory=factory)
        uri = URI.fromBytes(b'http://example.com/')
        returnedEndpoint = agent._getEndpoint(uri)
        self.assertEqual(returnedEndpoint, (b"http", b"example.com", 80))

        L{Agent.usingEndpointFactory} creates an L{Agent} that uses the given
        factory to create endpoints.
        
stackoverflow/venv/lib/python3.6/site-packages/twisted/web/test/test_agent.py