'When getting a redirect, L{client.RedirectAgent} follows the URL
specified in the L{Location} header field and make a new request.
@param code: HTTP status code.'

def _testRedirectDefault(self, code):

    self.agent.request('GET', 'http://example.com/foo')
    (host, port) = self.reactor.tcpClients.pop()[:2]
    self.assertEqual(EXAMPLE_COM_IP, host)
    self.assertEqual(80, port)
    (req, res) = self.protocol.requests.pop()
    if (ssl is None):
        scheme = 'http'
        expectedPort = 80
    else:
        scheme = 'https'
        expectedPort = 443
    headers = http_headers.Headers({'location': [(scheme + '://example.com/bar')]})
    response = Response(('HTTP', 1, 1), code, 'OK', headers, None)
    res.callback(response)
    (req2, res2) = self.protocol.requests.pop()
    self.assertEqual('GET', req2.method)
    self.assertEqual('/bar', req2.uri)
    (host, port) = self.reactor.tcpClients.pop()[:2]
    self.assertEqual(EXAMPLE_COM_IP, host)
    self.assertEqual(expectedPort, port)
