'Execute a web request based on plain text content.
@param httpRequest: Content for the request which is processed.
@type httpRequest: C{bytes}
@param requestFactory: 2-argument callable returning a Request.
@type requestFactory: C{callable}
@param success: Value to compare against I{self.didRequest}.
@type success: C{bool}
@param channel: Channel instance over which the request is processed.
@type channel: L{HTTPChannel}
@return: Returns the channel used for processing the request.
@rtype: L{HTTPChannel}'

def runRequest(self, httpRequest, requestFactory=None, success=True, channel=None):

    if (not channel):
        channel = http.HTTPChannel()
    if requestFactory:
        channel.requestFactory = _makeRequestProxyFactory(requestFactory)
    httpRequest = httpRequest.replace('\n', '\r\n')
    transport = StringTransport()
    channel.makeConnection(transport)
    for byte in iterbytes(httpRequest):
        if channel.transport.disconnecting:
            break
        channel.dataReceived(byte)
    channel.connectionLost(IOError('all    done'))
    if success:
        self.assertTrue(self.didRequest)
    else:
        self.assertFalse(self.didRequest)
    return channel
