#NEWLINE# def _testRender( self , uri , expectedURI ) : #NEWLINE# #INDENT# '\n        Check that a request pointing at C{uri} produce a new proxy connection,\n        with the path of this request pointing at C{expectedURI}.\n        ' #NEWLINE# root = Resource ( ) #NEWLINE# reactor = MemoryReactor ( ) #NEWLINE# resource = ReverseProxyResource ( '127.0.0.1' , 1234 , '/path' , reactor ) #NEWLINE# root . putChild ( 'index' , resource ) #NEWLINE# site = Site ( root ) #NEWLINE# transport = StringTransportWithDisconnection ( ) #NEWLINE# channel = site . buildProtocol ( None ) #NEWLINE# channel . makeConnection ( transport ) #NEWLINE# self . addCleanup ( channel . connectionLost , None ) #NEWLINE# channel . dataReceived ( ( 'GET %s HTTP/1.1\r\nAccept: text/html\r\n\r\n' % ( uri , ) ) ) #NEWLINE# self . assertEquals ( len ( reactor . tcpClients ) , 1 ) #NEWLINE# self . assertEquals ( reactor . tcpClients [ 0 ] [ 0 ] , '127.0.0.1' ) #NEWLINE# self . assertEquals ( reactor . tcpClients [ 0 ] [ 1 ] , 1234 ) #NEWLINE# factory = reactor . tcpClients [ 0 ] [ 2 ] #NEWLINE# self . assertIsInstance ( factory , ProxyClientFactory ) #NEWLINE# self . assertEquals ( factory . rest , expectedURI ) #NEWLINE# self . assertEquals ( factory . headers [ 'host' ] , '127.0.0.1:1234' )