'Build a fake proxy connection, and send C{data} over it, checking that
it\'s forwarded to the originating request.'

def _testDataForward(self, code, message, headers, body, method='GET', requestBody='', loseConnection=True):

    request = self.makeRequest('foo')
    client = self.makeProxyClient(request, method, {'accept': 'text/html'}, requestBody)
    receivedBody = self.assertForwardsHeaders(client, (method + '    /foo    HTTP/1.0'), {'connection': 'close', 'accept': 'text/html'})
    self.assertEqual(receivedBody, requestBody)
    client.dataReceived(self.makeResponseBytes(code, message, headers, body))
    self.assertForwardsResponse(request, code, message, headers, body)
    if loseConnection:
        client.transport.loseConnection()
    self.assertFalse(client.transport.connected)
    self.assertEqual(request.finished, 1)
