Code example for HandshakeCompletedEvent

Methods: getPeerPrincipal

0
     * javax.net.ssl.HandshakeCompletedEvent#getPeerPrincipal() 
     */ 
    public final void test_getPeerPrincipal() throws IOException { 
        mySSLSession session = new mySSLSession("localhost", 1080, null);
        SSLSocket socket = (SSLSocket) SSLSocketFactory.getDefault().createSocket();
        HandshakeCompletedEvent event = new HandshakeCompletedEvent(socket, session);
        assertNull(event.getPeerPrincipal());
    } 
 
    /** 
     * @throws IOException 
     * javax.net.ssl.HandshakeCompletedEvent#getSession() 
     */ 
    public final void test_getSession() throws IOException { 
        mySSLSession session = new mySSLSession("localhost", 1080, null);
        SSLSocket socket = (SSLSocket) SSLSocketFactory.getDefault().createSocket();
        HandshakeCompletedEvent event = new HandshakeCompletedEvent(socket, session);
        SSLSession ss = event.getSession();
        assertNotNull(ss);
        assertEquals(session, ss);
    }