Java 8 SSLSession - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 SSLSession class.

This code example shows how to use the following methods:getApplicationBufferSize, getPacketBufferSize
 
        SSLSession cliSession = cliEngine.getSession();
        SSLSession srvSession = srvEngine.getSession();
 
        // check packet buffer sizes. 
        if (cliSession.getPacketBufferSize() < 33049 ||
            srvSession.getPacketBufferSize() < 33049) {
                throw new Exception("Don't accept large SSL/TLS fragments");
        } 
 
        // check application data buffer sizes. 
        if (cliSession.getApplicationBufferSize() < 32768 ||
            srvSession.getApplicationBufferSize() < 32768) {
                throw new Exception(
                        "Don't accept large SSL/TLS application data "); 
        } 
    } 
} 
6
CodeRank
This code example shows how to use the following methods:getValue, putValue
    public void test_getValue() { 
        SSLSession s = clientSession;
        mySSLSessionBindingListener sbl = new mySSLSessionBindingListener();
 
        try { 
            s.getValue(null);
            fail("IllegalArgumentException wasn't thrown");
        } catch (IllegalArgumentException expected) {
            // expected 
        } 
 
        s.putValue("Name", sbl);
        Object obj = s.getValue("Name");
        assertTrue(obj instanceof SSLSessionBindingListener);
    } 
 
    Thread serverThread, clientThread;
    TestServer server;
    TestClient client;
 
6
CodeRank
This code example shows how to use the following methods:getCipherSuite, getLocalCertificates, getLocalPrincipal, getPeerCertificates, getPeerPrincipal
This code example shows how to use the following methods:getCipherSuite, getLocalCertificates, getLocalPrincipal, getPeerCertificates, getPeerPrincipal
import com.eviware.soapui.impl.wsdl.submit.transports.http.support.metrics.SoapUIMetrics; 
import com.eviware.soapui.impl.wsdl.support.CompressionSupport; 
import com.eviware.soapui.impl.wsdl.support.http.HttpClientSupport; 
import com.eviware.soapui.settings.HttpSettings; 
import com.eviware.soapui.support.StringUtils; 
import com.eviware.soapui.support.Tools; 
 
/** 
 * Extended PostMethod that supports limiting of response size and detailed 
 * timestamps 
 *  
 * @author Ole.Matzura 
 */ 
 
public class HttpMethodSupport 
{ 
	private long timeTaken;
	private long startTime;
	private long maxSize;
	private long responseReadTime;
5
CodeRank
This code example shows how to use the following methods:putValue, removeValue
    public void test_valueUnbound() throws UnknownHostException, IOException { 
        SSLSocket sock = (SSLSocket) SSLSocketFactory.getDefault()
                .createSocket();
        SSLSession ss = sock.getSession();
        mySSLSessionBindingListener sbl = new mySSLSessionBindingListener();
        ss.putValue("test", sbl);
        ss.removeValue("test");
        assertTrue("valueUnbound was not called.", sbl.unboundDone);
    } 
} 
5
CodeRank
This code example shows how to use the following methods:getApplicationBufferSize, getPacketBufferSize
 
        SSLSession cliSession = cliEngine.getSession();
        SSLSession srvSession = srvEngine.getSession();
 
        // check packet buffer sizes. 
        if (cliSession.getPacketBufferSize() < 33049 ||
            srvSession.getPacketBufferSize() < 33049) {
                throw new Exception("Don't accept large SSL/TLS fragments");
        } 
 
        // check application data buffer sizes. 
        if (cliSession.getApplicationBufferSize() < 32768 ||
            srvSession.getApplicationBufferSize() < 32768) {
                throw new Exception(
                        "Don't accept large SSL/TLS application data "); 
        } 
    } 
} 
5
CodeRank
This code example shows how to use the following methods:putValue
        { 
            for (String a:aliases)
            { 
                if (a.equals(x509.getAlias()))
                { 
                    session.putValue(SNI_X509,x509);
                    return a;
                } 
            } 
            return null; 
        } 
        return NO_MATCHERS;
    } 
 
    @Override 
    public String chooseServerAlias(String keyType, Principal[] issuers, Socket socket)
    { 
        SSLSocket sslSocket = (SSLSocket)socket;
 
        String alias = chooseServerAlias(keyType,issuers,sslSocket.getSSLParameters().getSNIMatchers(),sslSocket.getHandshakeSession());
4
CodeRank
This code example shows how to use the following methods:getApplicationBufferSize, getPacketBufferSize
This code example shows how to use the following methods:getCipherSuite, getProtocol
        System.out.println("   Local socket address = " + s.getLocalSocketAddress().toString());
        System.out.println("   Local address = " + s.getLocalAddress().toString());
        System.out.println("   Local port = " + s.getLocalPort());
        System.out.println("   Need client authentication = " + s.getNeedClientAuth());
        SSLSession ss = s.getSession();
        System.out.println("   Cipher suite = " + ss.getCipherSuite());
        System.out.println("   Protocol = " + ss.getProtocol());
    } 
 
    private static void printServerSocketInfo(SSLServerSocket s) {
        System.out.println("Server socket class: " + s.getClass());
        System.out.println("   Socker address = " + s.getInetAddress().toString());
        System.out.println("   Socker port = " + s.getLocalPort());
        System.out.println("   Need client authentication = " + s.getNeedClientAuth());
        System.out.println("   Want client authentication = " + s.getWantClientAuth());
        System.out.println("   Use client mode = " + s.getUseClientMode());
    } 
 
} 
5
CodeRank
This code example shows how to use the following methods:getCipherSuite
SSLSession ses = new MySSLSession();
 
        HandshakeCompletedEvent event = new HandshakeCompletedEvent(soc, ses);
         
        assertEquals(event.getCipherSuite(), ses.getCipherSuite());
    } 
 
    public final void testGetLocalCertificates() { 
    	if (noFreePort || noSocket) {
            return; 
        } 
    	SSLSession ses = new MySSLSession();
        HandshakeCompletedEvent event = new HandshakeCompletedEvent(soc, ses);
 
        Certificate[] certs = event.getLocalCertificates();
        Certificate[] ses_certs = ses.getLocalCertificates();
        if (certs == null && ses_certs == null) {
            return; 
        } 
5
CodeRank

Related Java 8 SSLSession Questions & Answers:

See Code Examples for Java 8 SSLSession Methods: