diff --git a/test/files/mock-rhsm-rest b/test/files/mock-rhsm-rest index 42e30e3b8..b3e25409b 100755 --- a/test/files/mock-rhsm-rest +++ b/test/files/mock-rhsm-rest @@ -62,6 +62,10 @@ class handler(BaseHTTPRequestHandler): if __name__ == '__main__': - httpd = HTTPServer(('', 443), handler) - httpd.socket = ssl.wrap_socket(httpd.socket, certfile=sys.argv[1], keyfile=sys.argv[2], server_side=True) - httpd.serve_forever() + context = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER) + context.load_cert_chain(certfile=sys.argv[1], keyfile=sys.argv[2]) + context.check_hostname = False + + with HTTPServer(("localhost", 443), handler) as httpd: + httpd.socket = context.wrap_socket(httpd.socket, server_side=True) + httpd.serve_forever()