HandshakeCompletedEvent getPeerPrincipal - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for HandshakeCompletedEvent getPeerPrincipal method.

This code example shows how to use the following methods:getPeerPrincipal
     * 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);
5
CodeRank
getPeerPrincipal Method Overview
Returns the Principal identifying the peer.
See Code Examples for other Java 8 HandshakeCompletedEvent Methods: