Skip to content

Commit

Permalink
fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
sfodagain committed Dec 6, 2024
1 parent f5af977 commit db527b3
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions tests/resources/main.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
import socket
import ssl
import os

context = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER)
cwd = os.getcwd()
print("Current dir is {}".format(cwd))
context.minimum_version = ssl.TLSVersion.TLSv1_3
context.maximum_version = ssl.TLSVersion.TLSv1_3
context.load_cert_chain('tls13.pem.crt', 'tls13.key')

with socket.socket(socket.AF_INET, socket.SOCK_STREAM, 0) as sock:
sock.bind(('127.0.0.1', 59443))
sock.listen(5)
with context.wrap_socket(sock, server_side=True) as ssock:
conn, addr = ssock.accept()
print("accepted new conn: {}".format(addr))
cnt = 0
while cnt < 2:
with socket.socket(socket.AF_INET, socket.SOCK_STREAM, 0) as sock:
sock.bind(('127.0.0.1', 59443))
sock.listen(5)
with context.wrap_socket(sock, server_side=True) as ssock:
conn, addr = ssock.accept()
print("accepted new conn: {}".format(addr))
cnt = cnt + 1

0 comments on commit db527b3

Please sign in to comment.