2525
2626import org .apache .http .conn .ssl .DefaultHostnameVerifier ;
2727import org .apache .http .conn .ssl .SSLConnectionSocketFactory ;
28+ import org .apache .http .impl .client .HttpClientBuilder ;
2829import org .apache .http .ssl .SSLContexts ;
30+ import org .apache .http .util .TextUtils ;
2931
3032import javax .net .ssl .HostnameVerifier ;
3133import javax .net .ssl .SSLContext ;
@@ -103,6 +105,19 @@ public EwsSSLProtocolSocketFactory(
103105 this .sslcontext = context ;
104106 }
105107
108+ /**
109+ * Constructor for EasySSLProtocolSocketFactory.
110+ *
111+ * @param context SSL context
112+ * @param hostnameVerifier hostname verifier
113+ */
114+ public EwsSSLProtocolSocketFactory (
115+ SSLContext context ,String [] supportedProtocols , String [] supportedCipherSuites , HostnameVerifier hostnameVerifier
116+ ) {
117+ super (context ,supportedProtocols ,supportedCipherSuites , hostnameVerifier );
118+ this .sslcontext = context ;
119+ }
120+
106121
107122 /**
108123 * Create and configure SSL protocol socket factory using default hostname verifier.
@@ -129,7 +144,22 @@ public static EwsSSLProtocolSocketFactory build(
129144 TrustManager trustManager , HostnameVerifier hostnameVerifier
130145 ) throws GeneralSecurityException {
131146 SSLContext sslContext = createSslContext (trustManager );
132- return new EwsSSLProtocolSocketFactory (sslContext , hostnameVerifier );
147+
148+ //read system properties
149+ String [] keepAliveStrategyCopy = null ;
150+ keepAliveStrategyCopy = split (System .getProperty ("https.protocols" ));
151+ String [] targetAuthStrategyCopy = null ;
152+ targetAuthStrategyCopy = split (System .getProperty ("https.cipherSuites" ));
153+
154+ if (null != keepAliveStrategyCopy || null != targetAuthStrategyCopy ) {
155+ return new EwsSSLProtocolSocketFactory (sslContext ,keepAliveStrategyCopy ,targetAuthStrategyCopy , hostnameVerifier );
156+ } else {
157+ return new EwsSSLProtocolSocketFactory (sslContext , hostnameVerifier );
158+ }
159+
160+ }
161+ private static String [] split (String s ) {
162+ return TextUtils .isBlank (s )?null :s .split (" *, *" );
133163 }
134164
135165 /**
0 commit comments