SslContext { @Deprecated public static SslContext newServerContext(File certChainFile, File keyFile) throws SSLException { return newServerContext(certChainFile, keyFile, null); } protected  SslContext(); protected  SslContext(boolean startTls); static SslProvider defaultServerProvider(); static SslProvider defaultClientProvider(); @Deprecated static SslContext newServerContext(File certChainFile, File keyFile); @Deprecated static SslContext newServerContext(
            File certChainFile, File keyFile, String keyPassword); @Deprecated static SslContext newServerContext(
            File certChainFile, File keyFile, String keyPassword,
            Iterable<String> ciphers, Iterable<String> nextProtocols,
            long sessionCacheSize, long sessionTimeout); @Deprecated static SslContext newServerContext(
            File certChainFile, File keyFile, String keyPassword,
            Iterable<String> ciphers, CipherSuiteFilter cipherFilter, ApplicationProtocolConfig apn,
            long sessionCacheSize, long sessionTimeout); @Deprecated static SslContext newServerContext(
            SslProvider provider, File certChainFile, File keyFile); @Deprecated static SslContext newServerContext(
            SslProvider provider, File certChainFile, File keyFile, String keyPassword); @Deprecated static SslContext newServerContext(
            SslProvider provider,
            File certChainFile, File keyFile, String keyPassword,
            Iterable<String> ciphers, Iterable<String> nextProtocols,
            long sessionCacheSize, long sessionTimeout); @Deprecated static SslContext newServerContext(
            SslProvider provider,
            File certChainFile, File keyFile, String keyPassword, TrustManagerFactory trustManagerFactory,
            Iterable<String> ciphers, Iterable<String> nextProtocols,
            long sessionCacheSize, long sessionTimeout); @Deprecated static SslContext newServerContext(SslProvider provider,
            File certChainFile, File keyFile, String keyPassword,
            Iterable<String> ciphers, CipherSuiteFilter cipherFilter, ApplicationProtocolConfig apn,
            long sessionCacheSize, long sessionTimeout); @Deprecated static SslContext newServerContext(
            SslProvider provider,
            File trustCertCollectionFile, TrustManagerFactory trustManagerFactory,
            File keyCertChainFile, File keyFile, String keyPassword, KeyManagerFactory keyManagerFactory,
            Iterable<String> ciphers, CipherSuiteFilter cipherFilter, ApplicationProtocolConfig apn,
            long sessionCacheSize, long sessionTimeout); @Deprecated static SslContext newClientContext(); @Deprecated static SslContext newClientContext(File certChainFile); @Deprecated static SslContext newClientContext(TrustManagerFactory trustManagerFactory); @Deprecated static SslContext newClientContext(
            File certChainFile, TrustManagerFactory trustManagerFactory); @Deprecated static SslContext newClientContext(
            File certChainFile, TrustManagerFactory trustManagerFactory,
            Iterable<String> ciphers, Iterable<String> nextProtocols,
            long sessionCacheSize, long sessionTimeout); @Deprecated static SslContext newClientContext(
            File certChainFile, TrustManagerFactory trustManagerFactory,
            Iterable<String> ciphers, CipherSuiteFilter cipherFilter, ApplicationProtocolConfig apn,
            long sessionCacheSize, long sessionTimeout); @Deprecated static SslContext newClientContext(SslProvider provider); @Deprecated static SslContext newClientContext(SslProvider provider, File certChainFile); @Deprecated static SslContext newClientContext(
            SslProvider provider, TrustManagerFactory trustManagerFactory); @Deprecated static SslContext newClientContext(
            SslProvider provider, File certChainFile, TrustManagerFactory trustManagerFactory); @Deprecated static SslContext newClientContext(
            SslProvider provider,
            File certChainFile, TrustManagerFactory trustManagerFactory,
            Iterable<String> ciphers, Iterable<String> nextProtocols,
            long sessionCacheSize, long sessionTimeout); @Deprecated static SslContext newClientContext(
            SslProvider provider,
            File certChainFile, TrustManagerFactory trustManagerFactory,
            Iterable<String> ciphers, CipherSuiteFilter cipherFilter, ApplicationProtocolConfig apn,
            long sessionCacheSize, long sessionTimeout); @Deprecated static SslContext newClientContext(
        SslProvider provider,
        File trustCertCollectionFile, TrustManagerFactory trustManagerFactory,
        File keyCertChainFile, File keyFile, String keyPassword,
        KeyManagerFactory keyManagerFactory,
        Iterable<String> ciphers, CipherSuiteFilter cipherFilter, ApplicationProtocolConfig apn,
        long sessionCacheSize, long sessionTimeout); final boolean isServer(); abstract boolean isClient(); abstract List<String> cipherSuites(); abstract long sessionCacheSize(); abstract long sessionTimeout(); @Deprecated final List<String> nextProtocols(); abstract ApplicationProtocolNegotiator applicationProtocolNegotiator(); abstract SSLEngine newEngine(ByteBufAllocator alloc); abstract SSLEngine newEngine(ByteBufAllocator alloc, String peerHost, int peerPort); abstract SSLSessionContext sessionContext(); final SslHandler newHandler(ByteBufAllocator alloc); final SslHandler newHandler(ByteBufAllocator alloc, String peerHost, int peerPort);  }
@Test public void testSslServerWithEncryptedPrivateKey() throws SSLException { File keyFile = new File(getClass().getResource("test_encrypted.pem").getFile()); File crtFile = new File(getClass().getResource("test.crt").getFile()); newServerContext(crtFile, keyFile, "12345"); }
@Test public void testSslServerWithEncryptedPrivateKey2() throws SSLException { File keyFile = new File(getClass().getResource("test2_encrypted.pem").getFile()); File crtFile = new File(getClass().getResource("test2.crt").getFile()); newServerContext(crtFile, keyFile, "12345"); }
@Test public void testSslServerWithUnencryptedPrivateKey() throws SSLException { File keyFile = new File(getClass().getResource("test_unencrypted.pem").getFile()); File crtFile = new File(getClass().getResource("test.crt").getFile()); newServerContext(crtFile, keyFile, null); }
@Test(expected = SSLException.class) public void testSslServerWithUnencryptedPrivateKeyEmptyPass() throws SSLException { File keyFile = new File(getClass().getResource("test_unencrypted.pem").getFile()); File crtFile = new File(getClass().getResource("test.crt").getFile()); newServerContext(crtFile, keyFile, ""); }