SslContextFactory { public SSLContext getSslContext() { return sslContext; } SslContextFactory();  SslContextFactory(SslConfiguration sslConfig); SSLContext getSslContext(); void checkKeyStore(); String[] selectProtocols(String[] enabledProtocols, String[] supportedProtocols); String[] selectCipherSuites(String[] enabledCipherSuites, String[] supportedCipherSuites); SSLServerSocket newSslServerSocket(String host,int port,int backlog); SSLSocket newSslSocket(); SSLEngine newSslEngine(String host,int port); SSLEngine newSslEngine();  }
@Test public void testNoTsFileKs() throws Exception { SslConfiguration cf = new SslConfiguration(); cf.setKeyStorePath("src/test/resources/keystore"); cf.setKeyStorePassword("changeit"); cf.setKeyManagerPassword("changeit"); SslContextFactory factory = new SslContextFactory(cf); Assert.assertTrue(factory.getSslContext() != null); }
@Test public void testNoTsNoKs() throws Exception { SslConfiguration cf = new SslConfiguration(); SslContextFactory factory = new SslContextFactory(cf); Assert.assertTrue(factory.getSslContext() != null); }
@Test public void testFileTsFileKs() throws Exception { SslConfiguration cf = new SslConfiguration(); cf.setKeyStorePath("src/test/resources/keystore"); cf.setKeyStorePassword("changeit"); cf.setKeyManagerPassword("changeit"); cf.setTrustStorePath("src/test/resources/keystore"); cf.setTrustStorePassword("changeit"); SslContextFactory factory = new SslContextFactory(cf); Assert.assertTrue(factory.getSslContext() != null); }