Exemplo n.º 1
0
        private string GetUriStringAndConfigureHandler(HttpsTestServer.Options options, HttpsTestServer server, HttpClientHandler handler)
        {
            if (Capability.AreHostsFileNamesInstalled())
            {
                string hostName =
                    (new UriBuilder("https", options.ServerCertificate.GetNameInfo(X509NameType.SimpleName, false), server.Port)).ToString();

                Console.WriteLine("[E2E testing] - Using hostname {0}", hostName);
                return(hostName);
            }
            else
            {
                handler.ServerCertificateCustomValidationCallback = AllowRemoteCertificateNameMismatch;
                return("https://localhost:" + server.Port.ToString());
            }
        }