Search in sources :

Example 16 with SSLSessionContext

use of javax.net.ssl.SSLSessionContext in project robovm by robovm.

the class SSLSessionContextTest method test_getSession.

/**
     * @throws NoSuchAlgorithmException
     * @throws KeyManagementException
     * javax.net.ssl.SSLSessionContex#getSession(byte[] sessionId)
     */
public final void test_getSession() throws NoSuchAlgorithmException, KeyManagementException {
    SSLContext context = SSLContext.getInstance("TLS");
    context.init(null, null, null);
    SSLSessionContext sc = context.getClientSessionContext();
    try {
        sc.getSession(null);
    } catch (NullPointerException e) {
    // expected
    }
    assertNull(sc.getSession(new byte[5]));
}
Also used : SSLSessionContext(javax.net.ssl.SSLSessionContext) SSLContext(javax.net.ssl.SSLContext)

Example 17 with SSLSessionContext

use of javax.net.ssl.SSLSessionContext in project robovm by robovm.

the class SSLSessionContextTest method test_getIds.

/**
     * @throws NoSuchAlgorithmException
     * @throws KeyManagementException
     * javax.net.ssl.SSLSessionContex#getIds()
     */
public final void test_getIds() throws NoSuchAlgorithmException, KeyManagementException {
    SSLContext context = SSLContext.getInstance("TLS");
    context.init(null, null, null);
    SSLSessionContext sc = context.getClientSessionContext();
    assertFalse(sc.getIds().hasMoreElements());
}
Also used : SSLSessionContext(javax.net.ssl.SSLSessionContext) SSLContext(javax.net.ssl.SSLContext)

Example 18 with SSLSessionContext

use of javax.net.ssl.SSLSessionContext in project jdk8u_jdk by JetBrains.

the class Timeout method main.

public static void main(String[] args) throws Exception {
    //        try {
    SSLServerSocketFactory ssf = (SSLServerSocketFactory) SSLServerSocketFactory.getDefault();
    SSLServerSocket ss = (SSLServerSocket) ssf.createServerSocket();
    String[] protocols = ss.getSupportedProtocols();
    for (int i = 0; i < protocols.length; i++) {
        //                try {
        if (protocols[i].equals("SSLv2Hello")) {
            continue;
        }
        SSLContext sslc = SSLContext.getInstance(protocols[i]);
        SSLSessionContext sslsc = sslc.getServerSessionContext();
        System.out.println("Protocol: " + protocols[i]);
        sslsc.setSessionTimeout(Integer.MAX_VALUE);
        int newtime = sslsc.getSessionTimeout();
        if (newtime != Integer.MAX_VALUE) {
            throw new Exception("Expected timeout: " + Integer.MAX_VALUE + ", got instead: " + newtime);
        }
    //                } catch (Exception e) {
    //                }
    }
    //        } catch (Exception e) {
    //            System.out.println(e);
    //        }
    System.out.println("Finished");
}
Also used : SSLSessionContext(javax.net.ssl.SSLSessionContext) SSLServerSocketFactory(javax.net.ssl.SSLServerSocketFactory) SSLContext(javax.net.ssl.SSLContext) SSLServerSocket(javax.net.ssl.SSLServerSocket)

Aggregations

SSLSessionContext (javax.net.ssl.SSLSessionContext)18 SSLContext (javax.net.ssl.SSLContext)10 SSLServerSocketFactory (javax.net.ssl.SSLServerSocketFactory)3 IOException (java.io.IOException)2 SSLException (javax.net.ssl.SSLException)2 SSLSocketFactory (javax.net.ssl.SSLSocketFactory)2 ByteBuf (io.netty.buffer.ByteBuf)1 Channel (io.netty.channel.Channel)1 SocketChannel (io.netty.channel.socket.SocketChannel)1 JdkSslContext (io.netty.handler.ssl.JdkSslContext)1 OpenSslServerContext (io.netty.handler.ssl.OpenSslServerContext)1 OpenSslServerSessionContext (io.netty.handler.ssl.OpenSslServerSessionContext)1 SslContext (io.netty.handler.ssl.SslContext)1 SslHandler (io.netty.handler.ssl.SslHandler)1 HttpServerOptions (io.vertx.core.http.HttpServerOptions)1 OpenSSLEngineOptions (io.vertx.core.net.OpenSSLEngineOptions)1 SSLHelper (io.vertx.core.net.impl.SSLHelper)1 InetSocketAddress (java.net.InetSocketAddress)1 KeyManagementException (java.security.KeyManagementException)1 KeyStore (java.security.KeyStore)1