public static SSLContext getInstance ( boolean server ) throws GeneralSecurityException { SSLContext retInstance = null ; if ( server ) { if ( serverInstance == null ) { synchronized ( BogusSslContextFactory . class ) { if ( serverInstance == null ) { try { serverInstance = createBougusServerSslContext ( ) ; } catch ( Exception ioe ) { throw new GeneralSecurityException ( "Can't create Server SSLContext:" + ioe ) ; } } } } retInstance = serverInstance ; } else { if ( clientInstance == null ) { synchronized ( BogusSslContextFactory . class ) { if ( clientInstance == null ) { clientInstance = createBougusClientSslContext ( ) ; } } } retInstance = clientInstance ; } return retInstance ; }
Get SSLContext singleton .