mirror of
https://github.com/eclipse-mosquitto/mosquitto.git
synced 2026-09-20 14:57:34 +08:00
Don't use deprecated wrap_socket.
This commit is contained in:
@@ -32,7 +32,9 @@ broker = mosq_test.start_broker(filename=os.path.basename(__file__), port=port2,
|
||||
|
||||
try:
|
||||
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||
ssock = ssl.wrap_socket(sock, ca_certs=f"{ssl_dir}/test-root-ca.crt", certfile=f"{ssl_dir}/client-expired.crt", keyfile=f"{ssl_dir}/client-expired.key", cert_reqs=ssl.CERT_REQUIRED)
|
||||
context = ssl.create_default_context(ssl.Purpose.SERVER_AUTH, cafile=f"{ssl_dir}/test-root-ca.crt")
|
||||
context.load_cert_chain(certfile=f"{ssl_dir}/client-expired.crt", keyfile=f"{ssl_dir}/client-expired.key")
|
||||
ssock = context.wrap_socket(sock, server_hostname="localhost")
|
||||
ssock.settimeout(20)
|
||||
ssock.connect(("localhost", port1))
|
||||
mosq_test.do_send_receive(ssock, connect_packet, connack_packet, "connack")
|
||||
|
||||
Reference in New Issue
Block a user