'Return an Agent suitable for use in tests that wrap the Agent and want
both a fake reactor and StubHTTPProtocol.'

def buildAgentForWrapperTest(self, reactor):

    agent = client.Agent(reactor)
    _oldGetEndpoint = agent._getEndpoint
    agent._getEndpoint = (lambda *args: self.StubEndpoint(_oldGetEndpoint(*args), self))
    return agent
