This repository was archived by the owner on Jan 13, 2021. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change 99import requests
1010import threading
1111import time
12+ import socket
1213import hyper
1314import hyper .http11 .connection
1415import pytest
2526 REQUEST_CODES , REQUEST_CODES_LENGTH
2627)
2728from hyper .http20 .exceptions import ConnectionError , StreamResetError
29+ from hyper .tls import wrap_socket
2830from server import SocketLevelTest
2931
3032# Turn off certificate verification for the tests.
@@ -74,6 +76,31 @@ def receive_preamble(sock):
7476 return
7577
7678
79+ class TestBasicSocketManipulation (SocketLevelTest ):
80+ # These aren't HTTP/2 tests, but it doesn't hurt to leave it.
81+ h2 = True
82+
83+ def test_connection_string (self ):
84+ self .set_up ()
85+ evt = threading .Event ()
86+
87+ def socket_handler (listener ):
88+ sock = listener .accept ()[0 ]
89+
90+ evt .wait (5 )
91+ sock .close ()
92+
93+ self ._start_server (socket_handler )
94+ s = socket .create_connection ((self .host , self .port ))
95+ s , proto = wrap_socket (s , "localhost" , force_proto = b"test" )
96+ s .close ()
97+ evt .set ()
98+
99+ assert proto == b"test"
100+
101+ self .tear_down ()
102+
103+
77104class TestHyperIntegration (SocketLevelTest ):
78105 # These are HTTP/2 tests.
79106 h2 = True
You can’t perform that action at this time.
0 commit comments