File tree 1 file changed +11
-5
lines changed
src/main/java/com/ning/http/util 1 file changed +11
-5
lines changed Original file line number Diff line number Diff line change 35
35
*/
36
36
public class SslUtils {
37
37
38
+ private static SSLContext context = null ;
39
+
38
40
public static SSLEngine getSSLEngine ()
39
41
throws GeneralSecurityException , IOException {
40
42
SSLEngine engine = null ;
@@ -50,12 +52,16 @@ public static SSLEngine getSSLEngine()
50
52
51
53
public static SSLContext getSSLContext ()
52
54
throws GeneralSecurityException , IOException {
53
- SSLConfig config = new SSLConfig ();
54
- if (config .keyStoreLocation == null || config .trustStoreLocation == null ) {
55
- return getLooseSSLContext ();
56
- } else {
57
- return getStrictSSLContext (config );
55
+ if (context == null ) {
56
+ SSLConfig config = new SSLConfig ();
57
+ if (config .keyStoreLocation == null
58
+ || config .trustStoreLocation == null ) {
59
+ context = getLooseSSLContext ();
60
+ } else {
61
+ context = getStrictSSLContext (config );
62
+ }
58
63
}
64
+ return context ;
59
65
}
60
66
61
67
static SSLContext getStrictSSLContext (SSLConfig config )
You can’t perform that action at this time.
0 commit comments