def _testRender(self, uri, expectedURI):
        """
        Check that a request pointing at C{uri} produce a new proxy connection,
        with the path of this request pointing at C{expectedURI}.
        """
        root = Resource()
        reactor = MemoryReactor()
        resource = ReverseProxyResource(u"127.0.0.1", 1234, b"/path", reactor)
        root.putChild(b'index', resource)
        site = Site(root)

        transport = StringTransportWithDisconnection()
        channel = site.buildProtocol(None)
        channel.makeConnection(transport)
        # Clear the timeout if the tests failed
        self.addCleanup(channel.connectionLost, None)

        channel.dataReceived(b"GET " +
                             uri +
                             b" HTTP/1.1\r\nAccept: text/html\r\n\r\n")

        [(host, port, factory, _timeout, _bind_addr)] = reactor.tcpClients
        # Check that one connection has been created, to the good host/port
        self.assertEqual(host, u"127.0.0.1")
        self.assertEqual(port, 1234)

        # Check the factory passed to the connect, and its given path
        self.assertIsInstance(factory, ProxyClientFactory)
        self.assertEqual(factory.rest, expectedURI)
        self.assertEqual(factory.headers[b"host"], b"127.0.0.1:1234")

        Check that a request pointing at C{uri} produce a new proxy connection,
        with the path of this request pointing at C{expectedURI}.
        
stackoverflow/venv/lib/python3.6/site-packages/twisted/web/test/test_proxy.py