Package javax.net.ssl

Examples of javax.net.ssl.HandshakeCompletedListener


        SSLContext sslCtx = SSLContext.getInstance("TLS");
        sslCtx.init(null, TesterSupport.TRUST_ALL_CERTS, new java.security.SecureRandom());
        SSLSocketFactory socketFactory = sslCtx.getSocketFactory();
        SSLSocket socket = (SSLSocket) socketFactory.createSocket("localhost", getPort());

        socket.addHandshakeCompletedListener(new HandshakeCompletedListener() {
            @Override
            public void handshakeCompleted(HandshakeCompletedEvent event) {
                handshakeDone = true;
            }
        });
View Full Code Here


            log.debug("    cipher suites:");

            for (int i = 0; i < iorSuites.length; i++) {
                log.debug("    " + iorSuites[i]);
            }
            socket.addHandshakeCompletedListener(new HandshakeCompletedListener() {

                public void handshakeCompleted(HandshakeCompletedEvent handshakeCompletedEvent) {
                    Certificate[] certs = handshakeCompletedEvent.getLocalCertificates();
                    if (certs != null) {
                        log.debug("handshake returned local certs count: " + certs.length);
View Full Code Here

           /*
           * register a callback for handshaking completion event
           */
      Socket so = factory.createSocket(s, i);
           ((SSLSocket)so).addHandshakeCompletedListener(
              new HandshakeCompletedListener() {
                 public void handshakeCompleted(
                    HandshakeCompletedEvent event) {
                    System.out.println("Handshake finished!");
                    System.out.println(
                    "\t CipherSuite:" + event.getCipherSuite());
View Full Code Here

                    autoClose);
        } else {
            result = (SSLSocket) factory.createSocket(host, port);
        }
        result.addHandshakeCompletedListener(
                new HandshakeCompletedListener() {
            public void handshakeCompleted(HandshakeCompletedEvent event) {
                Log.debug(CLASS_NAME,
                        "Handshake Finished!" + "\t CipherSuite :"
                        + event.getCipherSuite() + "\t SessionId: "
                        + event.getSession() + "\t PeerHost: "
View Full Code Here

     * method testing.
     * removeHandshakeCompletedListener( HandshakeCompletedListener listener)
     * method testing.
     */
    public void testAddRemoveHandshakeCompletedListener() throws Exception {
        HandshakeCompletedListener listener =
            new HandshakeCompletedListener() {
                public void handshakeCompleted(
                        HandshakeCompletedEvent event) { }
            };
        SSLSocket socket = createSSLSocket();
        socket.addHandshakeCompletedListener(listener);
        try {
            socket.addHandshakeCompletedListener(null);
            fail("Expected IllegalArgumentException was not thrown.");
        } catch (IllegalArgumentException e) { }
        try {
            socket.removeHandshakeCompletedListener(null);
            fail("Expected IllegalArgumentException was not thrown.");
        } catch (IllegalArgumentException e) { }
        try {
            socket.removeHandshakeCompletedListener(
                    new HandshakeCompletedListener() {
                        public void handshakeCompleted(
                                HandshakeCompletedEvent event) { }
                    });
            fail("Expected IllegalArgumentException was not thrown.");
        } catch (IllegalArgumentException e) { }
View Full Code Here

        }
       
    //trace( "creating socket: " + target );
        final SSLSocket sslSocket  = (SSLSocket)mFactory.createSocket( host, port );
       
    final HandshakeCompletedListener  listener  = env.getHandshakeCompletedListener( );
    if ( listener != null )
    {
      trace( "createSocket: added HandshakeCompletedListener: " + listener );
      sslSocket.addHandshakeCompletedListener( listener );
    }
View Full Code Here

    }
   
    public static TLSParams createTLSParams() {
        File trustStoreFile = getDefaultTrustStore();
        char[] trustStorePassword =  DEFAULT_TRUST_STORE_PASSWORD.toCharArray();
        HandshakeCompletedListener handshakeCompletedListener   =
                new HandshakeCompletedListenerImpl();
        TrustStoreTrustManager trustMgr =
                new TrustStoreTrustManager( trustStoreFile, trustStorePassword);
        trustMgr.setPrompt( false );
        mTLSParams = new TLSParams(trustMgr, handshakeCompletedListener);
View Full Code Here

        // adds the the new certificate to the in-memory cert database
        TrustManager[] newTrustMgrs =
              new TrustManager[] {new X509TrustManagerImpl(serverName, cert)};
        env.setTrustManagers(newTrustMgrs);

        HandshakeCompletedListener listener =
            new HandshakeCompletedListenerImpl();
        env.setHandshakeCompletedListener(listener);
    }
View Full Code Here

        SSLContext sslCtx = SSLContext.getInstance("TLS");
        sslCtx.init(null, TesterSupport.getTrustManagers(), null);
        SSLSocketFactory socketFactory = sslCtx.getSocketFactory();
        SSLSocket socket = (SSLSocket) socketFactory.createSocket("localhost", getPort());

        socket.addHandshakeCompletedListener(new HandshakeCompletedListener() {
            @Override
            public void handshakeCompleted(HandshakeCompletedEvent event) {
                handshakeDone = true;
            }
        });
View Full Code Here

        SSLContext sslCtx = SSLContext.getInstance("TLS");
        sslCtx.init(null, trustAllCerts, new java.security.SecureRandom());
        SSLSocketFactory socketFactory = sslCtx.getSocketFactory();
        SSLSocket socket = (SSLSocket) socketFactory.createSocket("localhost", getPort());

        socket.addHandshakeCompletedListener(new HandshakeCompletedListener() {
            @Override
            public void handshakeCompleted(HandshakeCompletedEvent event) {
                handshakeDone = true;
            }
        });
View Full Code Here

TOP

Related Classes of javax.net.ssl.HandshakeCompletedListener

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.