'Set up a resource on a distrib site using L{ResourcePublisher} and
then retrieve it from a L{ResourceSubscription} via an HTTP client.
@param child: The resource to publish using distrib.
@param **kwargs: Extra keyword arguments to pass to L{Agent.request} when
requesting the resource.
@return: A L{Deferred} which fires with a tuple consisting of a
L{twisted.test.proto_helpers.AccumulatingProtocol} containing the
body of the response and an L{IResponse} with the response itself.'

def _requestAgentTest(self, child, **kwargs):

    (mainPort, mainAddr) = self._setupDistribServer(child)
    url = 'http://{}:{}/child'.format(mainAddr.host, mainAddr.port)
    url = url.encode('ascii')
    d = client.Agent(reactor).request('GET', url, **kwargs)
    def cbCollectBody(response):
        protocol = proto_helpers.AccumulatingProtocol()
        response.deliverBody(protocol)
        d = protocol.closedDeferred = defer.Deferred()
        d.addCallback((lambda _: (protocol, response)))
        return d
    d.addCallback(cbCollectBody)
    return d
