コード例 #1
0
 def test_connection_refused(self):
     # Does the pool retry if there is no listener on the port?
     host, port = get_unreachable_address()
     pool = HTTPConnectionPool(host, port)
     self.aioAssertRaises(MaxRetryError,
                          pool.request,
                          'GET',
                          '/',
                          retries=0)
コード例 #2
0
    def test_proxy_conn_fail(self):
        host, port = get_unreachable_address()
        http = proxy_from_url('http://%s:%s/' % (host, port), retries=1)
        #self.aioAssertRaises(MaxRetryError, http.request, 'GET', '%s/' % self.https_url)
        self.aioAssertRaises(MaxRetryError, http.request, 'GET', '%s/' % self.http_url)

        try:
            yield from http.request('GET', '%s/' % self.http_url)
            self.fail("Failed to raise retry error.")
        except MaxRetryError as e:
            self.assertEqual(type(e.reason), ProxyError)
コード例 #3
0
    def test_proxy_conn_fail(self):
        host, port = get_unreachable_address()
        http = proxy_from_url('http://%s:%s/' % (host, port), retries=1)
        #self.aioAssertRaises(MaxRetryError, http.request, 'GET', '%s/' % self.https_url)
        self.aioAssertRaises(MaxRetryError, http.request, 'GET',
                             '%s/' % self.http_url)

        try:
            yield From(http.request('GET', '%s/' % self.http_url))
            self.fail("Failed to raise retry error.")
        except MaxRetryError as e:
            self.assertEqual(type(e.reason), ProxyError)
コード例 #4
0
 def test_connection_refused(self):
     # Does the pool retry if there is no listener on the port?
     host, port = get_unreachable_address()
     pool = HTTPConnectionPool(host, port)
     self.aioAssertRaises(MaxRetryError, pool.request, 'GET', '/', retries=0)