@Test public void testGetInstanceWithBadCert() throws Exception { SSLConfig sslConfig = new SSLConfig(); sslConfig.setKeyStoreName("FOO"); sslConfig.setKeyStorePassword("BAR".toCharArray()); sslConfig.setKeyStoreType("JKS"); sslConfig.setKeyManagerFactoryAlgorithm("SunX509"); SSLContextFactory.getInstance(sslConfig); }
public static SSLContext getInstance(SSLConfig sslConfig) throws GeneralSecurityException { synchronized (contextCache) { SSLContext context = contextCache.get(sslConfig); if (context == null) { try { context = createSSLContext(sslConfig); contextCache.put(sslConfig, context); } catch (Exception ioe) { throw new GeneralSecurityException("Can't create SSLContext", ioe); } } return context; } }
SSLContextFactory { public static SSLContext getInstance(SSLConfig sslConfig) throws GeneralSecurityException { synchronized (contextCache) { SSLContext context = contextCache.get(sslConfig); if (context == null) { try { context = createSSLContext(sslConfig); contextCache.put(sslConfig, context); } catch (Exception ioe) { throw new GeneralSecurityException("Can't create SSLContext", ioe); } } return context; } } }
SSLContextFactory { public static SSLContext getInstance(SSLConfig sslConfig) throws GeneralSecurityException { synchronized (contextCache) { SSLContext context = contextCache.get(sslConfig); if (context == null) { try { context = createSSLContext(sslConfig); contextCache.put(sslConfig, context); } catch (Exception ioe) { throw new GeneralSecurityException("Can't create SSLContext", ioe); } } return context; } }  }
SSLContextFactory { public static SSLContext getInstance(SSLConfig sslConfig) throws GeneralSecurityException { synchronized (contextCache) { SSLContext context = contextCache.get(sslConfig); if (context == null) { try { context = createSSLContext(sslConfig); contextCache.put(sslConfig, context); } catch (Exception ioe) { throw new GeneralSecurityException("Can't create SSLContext", ioe); } } return context; } }  static SSLContext getInstance(SSLConfig sslConfig); }
SSLContextFactory { public static SSLContext getInstance(SSLConfig sslConfig) throws GeneralSecurityException { synchronized (contextCache) { SSLContext context = contextCache.get(sslConfig); if (context == null) { try { context = createSSLContext(sslConfig); contextCache.put(sslConfig, context); } catch (Exception ioe) { throw new GeneralSecurityException("Can't create SSLContext", ioe); } } return context; } }  static SSLContext getInstance(SSLConfig sslConfig);  }