2626import org .apache .http .conn .ssl .DefaultHostnameVerifier ;
2727import org .apache .http .conn .ssl .SSLConnectionSocketFactory ;
2828import org .apache .http .ssl .SSLContexts ;
29+ import org .apache .http .util .TextUtils ;
2930
3031import javax .net .ssl .HostnameVerifier ;
3132import javax .net .ssl .SSLContext ;
@@ -103,6 +104,22 @@ public EwsSSLProtocolSocketFactory(
103104 this .sslcontext = context ;
104105 }
105106
107+ /**
108+ * Constructor for EasySSLProtocolSocketFactory.
109+ *
110+ * @param context SSL context
111+ * @param supportedProtocols protocol from sys prop
112+ * @param supportedCipherSuites cipherSuites from sys prop
113+ * @param hostnameVerifier hostname verifier
114+ */
115+ public EwsSSLProtocolSocketFactory (
116+ SSLContext context ,String [] supportedProtocols , String [] supportedCipherSuites ,
117+ HostnameVerifier hostnameVerifier
118+ ) {
119+ super (context ,supportedProtocols ,supportedCipherSuites , hostnameVerifier );
120+ this .sslcontext = context ;
121+ }
122+
106123
107124 /**
108125 * Create and configure SSL protocol socket factory using default hostname verifier.
@@ -129,7 +146,22 @@ public static EwsSSLProtocolSocketFactory build(
129146 TrustManager trustManager , HostnameVerifier hostnameVerifier
130147 ) throws GeneralSecurityException {
131148 SSLContext sslContext = createSslContext (trustManager );
132- return new EwsSSLProtocolSocketFactory (sslContext , hostnameVerifier );
149+
150+ //read system properties
151+ String [] keepAliveStrategyCopy ;
152+ keepAliveStrategyCopy = split (System .getProperty ("https.protocols" ));
153+ String [] targetAuthStrategyCopy ;
154+ targetAuthStrategyCopy = split (System .getProperty ("https.cipherSuites" ));
155+
156+ if (null != keepAliveStrategyCopy || null != targetAuthStrategyCopy ) {
157+ return new EwsSSLProtocolSocketFactory (sslContext ,keepAliveStrategyCopy ,targetAuthStrategyCopy , hostnameVerifier );
158+ } else {
159+ return new EwsSSLProtocolSocketFactory (sslContext , hostnameVerifier );
160+ }
161+ }
162+
163+ private static String [] split (String s ) {
164+ return TextUtils .isBlank (s )?null :s .split (" *, *" );
133165 }
134166
135167 /**
0 commit comments