Skip to content
This repository has been archived by the owner on Jan 13, 2021. It is now read-only.

Commit

Permalink
Add basic test for force_proto
Browse files Browse the repository at this point in the history
  • Loading branch information
Lukasa committed Mar 23, 2016
1 parent ae56862 commit 2ca177c
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions test/test_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import requests
import threading
import time
import socket
import hyper
import hyper.http11.connection
import pytest
Expand All @@ -25,6 +26,7 @@
REQUEST_CODES, REQUEST_CODES_LENGTH
)
from hyper.http20.exceptions import ConnectionError, StreamResetError
from hyper.tls import wrap_socket
from server import SocketLevelTest

# Turn off certificate verification for the tests.
Expand Down Expand Up @@ -74,6 +76,31 @@ def receive_preamble(sock):
return


class TestBasicSocketManipulation(SocketLevelTest):
# These aren't HTTP/2 tests, but it doesn't hurt to leave it.
h2 = True

def test_connection_string(self):
self.set_up()
evt = threading.Event()

def socket_handler(listener):
sock = listener.accept()[0]

evt.wait(5)
sock.close()

self._start_server(socket_handler)
s = socket.create_connection((self.host, self.port))
s, proto = wrap_socket(s, "localhost", force_proto=b"test")
s.close()
evt.set()

assert proto == b"test"

self.tear_down()


class TestHyperIntegration(SocketLevelTest):
# These are HTTP/2 tests.
h2 = True
Expand Down

0 comments on commit 2ca177c

Please sign in to comment.