Code example for HandshakeCompletedEvent

Methods: getLocalPrincipal

0
     * javax.net.ssl.HandshakeCompletedEvent#getLocalPrincipal() 
     */ 
    public final void test_getLocalPrincipal() throws Exception { 
        mySSLSession session = new mySSLSession("localhost", 1080, null);
        SSLSocket socket = (SSLSocket) SSLSocketFactory.getDefault().createSocket();
        HandshakeCompletedEvent event = new HandshakeCompletedEvent(socket, session);
        assertNull(event.getLocalPrincipal());
    } 
 
    /** 
     * @throws IOException 
     * javax.net.ssl.HandshakeCompletedEvent#getPeerCertificateChain() 
     */ 
    public final void test_getPeerCertificateChain() throws Exception { 
        ByteArrayInputStream bis = new ByteArrayInputStream(certificate.getBytes());
        mySSLSession session = new mySSLSession((X509Certificate[]) null);
        SSLSocket socket = (SSLSocket) SSLSocketFactory.getDefault().createSocket();
        HandshakeCompletedEvent event = new HandshakeCompletedEvent(socket, session);
        try { 
            event.getPeerCertificateChain();
            fail("SSLPeerUnverifiedException wasn't thrown");