@Test public void testSSLFactory() throws Exception { TestSSLUtils.testSSLFactoryImpl(JdkSslFactory.class.getName()); File trustStoreFile = File.createTempFile("truststore", ".jks"); Properties props = new Properties(); TestSSLUtils.addSSLProperties(props, "DC1,DC2,DC3", SSLFactory.Mode.CLIENT, trustStoreFile, "client"); for (String prngAlgorithm : new String[]{"NativePRNGNonBlocking", "SHA1PRNG", "Windows-PRNG", "badbadinvalid"}) { boolean valid = true; try { SecureRandom.getInstance(prngAlgorithm); } catch (NoSuchAlgorithmException e) { valid = false; } props.put("ssl.secure.random.algorithm", prngAlgorithm); SSLConfig config = new SSLConfig(new VerifiableProperties(props)); if (valid) { JdkSslFactory jdkSslFactory = new JdkSslFactory(config); assertNotNull("Invalid SSLContext", jdkSslFactory.getSSLContext()); } else { TestUtils.assertException(NoSuchAlgorithmException.class, () -> new JdkSslFactory(config), null); } } props.put("ssl.secure.random.algorithm", ""); SSLConfig config = new SSLConfig(new VerifiableProperties(props)); JdkSslFactory jdkSslFactory = new JdkSslFactory(config); assertNotNull("Invalid SSLContext", jdkSslFactory.getSSLContext()); }
@Override public SSLContext getSSLContext() { return sslContext; }
JdkSslFactory implements SSLFactory { @Override public SSLContext getSSLContext() { return sslContext; } }
JdkSslFactory implements SSLFactory { @Override public SSLContext getSSLContext() { return sslContext; } JdkSslFactory(SSLConfig sslConfig); }
JdkSslFactory implements SSLFactory { @Override public SSLContext getSSLContext() { return sslContext; } JdkSslFactory(SSLConfig sslConfig); @Override SSLEngine createSSLEngine(String peerHost, int peerPort, Mode mode); @Override SSLContext getSSLContext(); }
JdkSslFactory implements SSLFactory { @Override public SSLContext getSSLContext() { return sslContext; } JdkSslFactory(SSLConfig sslConfig); @Override SSLEngine createSSLEngine(String peerHost, int peerPort, Mode mode); @Override SSLContext getSSLContext();  }