'Fail a first request, possibly retrying depending on argument.'

def retryAttempt(self, willWeRetry):

    protocols = []
    def newProtocol():
        protocol = StubHTTPProtocol()
        protocols.append(protocol)
        return defer.succeed(protocol)
    bodyProducer = object()
    request = client.Request('FOO', '/', client.Headers(), bodyProducer, persistent=True)
    newProtocol()
    protocol = protocols[0]
    retrier = client._RetryingHTTP11ClientProtocol(protocol, newProtocol)
    def _shouldRetry(m, e, bp):
        self.assertEqual(m, 'FOO')
        self.assertIdentical(bp, bodyProducer)
        self.assertIsInstance(e, (RequestNotSent, ResponseNeverReceived))
        return willWeRetry
    retrier._shouldRetry = _shouldRetry
    d = retrier.request(request)
    self.assertEqual(len(protocols), 1)
    self.assertEqual(len(protocols[0].requests), 1)
    protocol.requests[0][1].errback(RequestNotSent())
    return (d, protocols)
