1010capable of achieving basic tasks.
1111"""
1212
13- from concurrent .futures import as_completed , ThreadPoolExecutor
1413import logging
1514import random
15+ from concurrent .futures import as_completed , ThreadPoolExecutor
16+
1617import requests
17- import threading
18+
1819from hyper import HTTP20Connection , HTTP11Connection , HTTPConnection
1920from hyper .common .util import HTTPVersion
2021from hyper .contrib import HTTP20Adapter
2122
2223logging .basicConfig (level = logging .INFO )
2324
25+
2426class TestHyperActuallyWorks (object ):
2527 def test_abusing_nghttp2_org (self ):
2628 """
@@ -93,32 +95,32 @@ def do_one_page(path):
9395 assert text_data
9496
9597 max_workers = len (paths )
96- with ThreadPoolExecutor (max_workers = len ( paths ) ) as ex :
98+ with ThreadPoolExecutor (max_workers = max_workers ) as ex :
9799 futures = [ex .submit (do_one_page , p ) for p in paths ]
98100 for f in as_completed (futures ):
99101 f .result ()
100102
101- def test_hitting_http2bin_org (self ):
103+ def test_hitting_nghttp2_org (self ):
102104 """
103- This test function uses the requests adapter and requests to talk to http2bin .
105+ This test function uses the requests adapter and requests to talk to nghttp2.org/httpbin .
104106 """
105107 s = requests .Session ()
106108 a = HTTP20Adapter ()
107- s .mount ('https://http2bin ' , a )
108- s .mount ('https://www.http2bin ' , a )
109+ s .mount ('https://nghttp2 ' , a )
110+ s .mount ('https://www.nghttp2 ' , a )
109111
110112 # Here are some nice URLs.
111113 urls = [
112- 'https://www.http2bin .org/' ,
113- 'https://www.http2bin .org/ip' ,
114- 'https://www.http2bin .org/user-agent' ,
115- 'https://www.http2bin .org/headers' ,
116- 'https://www.http2bin .org/get' ,
117- 'https://http2bin .org/' ,
118- 'https://http2bin .org/ip' ,
119- 'https://http2bin .org/user-agent' ,
120- 'https://http2bin .org/headers' ,
121- 'https://http2bin .org/get' ,
114+ 'https://www.nghttp2 .org/httpbin /' ,
115+ 'https://www.nghttp2 .org/httpbin /ip' ,
116+ 'https://www.nghttp2 .org/httpbin /user-agent' ,
117+ 'https://www.nghttp2 .org/httpbin /headers' ,
118+ 'https://www.nghttp2 .org/httpbin /get' ,
119+ 'https://nghttp2 .org/httpbin /' ,
120+ 'https://nghttp2 .org/httpbin /ip' ,
121+ 'https://nghttp2 .org/httpbin /user-agent' ,
122+ 'https://nghttp2 .org/httpbin /headers' ,
123+ 'https://nghttp2 .org/httpbin /get' ,
122124 ]
123125
124126 # Go get everything.
@@ -132,7 +134,7 @@ def test_hitting_httpbin_org_http11(self):
132134 """
133135 This test function uses hyper's HTTP/1.1 support to talk to httpbin
134136 """
135- c = HTTP11Connection ('httpbin.org' )
137+ c = HTTP11Connection ('httpbin.org:443 ' )
136138
137139 # Here are some nice URLs.
138140 urls = [
0 commit comments