Code example for SSLEngine

Methods: getSessionsetUseClientMode

0
 
        // set the property before initialization SSLEngine. 
        System.setProperty("jsse.SSLEngine.acceptLargeFragments", "true");
 
        SSLEngine cliEngine = context.createSSLEngine();
        cliEngine.setUseClientMode(true);
 
        SSLEngine srvEngine = context.createSSLEngine();
        srvEngine.setUseClientMode(false);
 
        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.