#NEWLINE# def _testDataForward( self , code , message , headers , body , method = b'GET' , requestBody = b'' , loseConnection = True ) : #NEWLINE# #INDENT# "\n        Build a fake proxy connection, and send C{data} over it, checking that\n        it's forwarded to the originating request.\n        " #NEWLINE# request = self . makeRequest ( b'foo' ) #NEWLINE# client = self . makeProxyClient ( request , method , { #NEWLINE# #INDENT# b'accept' : b'text/html' , #NEWLINE# #UNINDENT# } , requestBody ) #NEWLINE# receivedBody = self . assertForwardsHeaders ( client , ( method + b' /foo HTTP/1.0' ) , { #NEWLINE# #INDENT# b'connection' : b'close' , #NEWLINE# b'accept' : b'text/html' , #NEWLINE# #UNINDENT# } ) #NEWLINE# self . assertEqual ( receivedBody , requestBody ) #NEWLINE# client . dataReceived ( self . makeResponseBytes ( code , message , headers , body ) ) #NEWLINE# self . assertForwardsResponse ( request , code , message , headers , body ) #NEWLINE# if loseConnection : #NEWLINE# #INDENT# client . transport . loseConnection ( ) #NEWLINE# #UNINDENT# self . assertFalse ( client . transport . connected ) #NEWLINE# self . assertEqual ( request . finished , 1 )