/// <exception cref="System.IO.IOException"/> /// <exception cref="Sharpen.GeneralSecurityException"/> private static ConnectionConfigurator NewSslConnConfigurator(int timeout, Configuration conf) { SSLFactory factory; SSLSocketFactory sf; HostnameVerifier hv; factory = new SSLFactory(SSLFactory.Mode.Client, conf); factory.Init(); sf = factory.CreateSSLSocketFactory(); hv = factory.GetHostnameVerifier(); return(new _ConnectionConfigurator_536(sf, hv, timeout)); }
/// <exception cref="System.IO.IOException"/> private HttpURLConnection ConfigureConnection(HttpURLConnection conn) { if (sslFactory != null) { HttpsURLConnection httpsConn = (HttpsURLConnection)conn; try { httpsConn.SetSSLSocketFactory(sslFactory.CreateSSLSocketFactory()); } catch (GeneralSecurityException ex) { throw new IOException(ex); } httpsConn.SetHostnameVerifier(sslFactory.GetHostnameVerifier()); } return(conn); }
protected internal virtual void OpenConnection(Uri url) { lock (this) { HttpURLConnection conn = (HttpURLConnection)url.OpenConnection(); if (sslShuffle) { HttpsURLConnection httpsConn = (HttpsURLConnection)conn; try { httpsConn.SetSSLSocketFactory(sslFactory.CreateSSLSocketFactory()); } catch (GeneralSecurityException ex) { throw new IOException(ex); } httpsConn.SetHostnameVerifier(sslFactory.GetHostnameVerifier()); } connection = conn; } }