HttpClient.ViewController.RunTls12Request C# (CSharp) Method

RunTls12Request() private method

private RunTls12Request ( ) : void
return void
		void RunTls12Request ()
		{
			var actual = ServicePointManager.SecurityProtocol;

			try {
				ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;

				var request = new HttpWebRequest (new Uri ("https://howsmyssl.com:443/a/check"));
				ServicePointManager.ServerCertificateValidationCallback = delegate { return true; };
				var clientCertificate = new X509Certificate2 ("cert.pem");
				request.ClientCertificates.Add (clientCertificate);
				var msg = request.GetResponse ();

				using (var stream = msg.GetResponseStream ())
					RenderStream (stream);
			} catch (WebException ex) {
				Console.WriteLine (ex.Message);
			} finally {
				ServicePointManager.SecurityProtocol = actual;
			}
		}
	}