本文整理汇总了Java中javax.net.ssl.SSLSession.getApplicationBufferSize方法的典型用法代码示例。如果您正苦于以下问题:Java SSLSession.getApplicationBufferSize方法的具体用法?Java SSLSession.getApplicationBufferSize怎么用?Java SSLSession.getApplicationBufferSize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.net.ssl.SSLSession
的用法示例。
在下文中一共展示了SSLSession.getApplicationBufferSize方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createBuffers
import javax.net.ssl.SSLSession; //导入方法依赖的package包/类
protected void createBuffers(SSLSession session) {
int appBufferMax = session.getApplicationBufferSize();
int netBufferMax = session.getPacketBufferSize();
if (this.inData == null) {
this.inData = ByteBuffer.allocate(appBufferMax);
this.outCrypt = ByteBuffer.allocate(netBufferMax);
this.inCrypt = ByteBuffer.allocate(netBufferMax);
} else {
if (this.inData.capacity() != appBufferMax) {
this.inData = ByteBuffer.allocate(appBufferMax);
}
if (this.outCrypt.capacity() != netBufferMax) {
this.outCrypt = ByteBuffer.allocate(netBufferMax);
}
if (this.inCrypt.capacity() != netBufferMax) {
this.inCrypt = ByteBuffer.allocate(netBufferMax);
}
}
this.inData.rewind();
this.inData.flip();
this.inCrypt.rewind();
this.inCrypt.flip();
this.outCrypt.rewind();
this.outCrypt.flip();
}
示例2: createBuffers
import javax.net.ssl.SSLSession; //导入方法依赖的package包/类
protected void createBuffers() {
SSLSession session = sslStateMachine.sslEngine.getSession();
appBufferMax = session.getApplicationBufferSize();
netBufferMax = session.getPacketBufferSize();
if(logger.isLoggingEnabled(LogWriter.TRACE_DEBUG)) {
logger.logDebug("appBufferMax=" + appBufferMax + " netBufferMax=" + netBufferMax);
}
}
示例3: createBuffers
import javax.net.ssl.SSLSession; //导入方法依赖的package包/类
private void createBuffers() {
SSLSession session = sslStateMachine.sslEngine.getSession();
appBufferMax = session.getApplicationBufferSize();
netBufferMax = session.getPacketBufferSize();
if(logger.isLoggingEnabled(LogWriter.TRACE_DEBUG)) {
logger.logDebug("appBufferMax=" + appBufferMax + " netBufferMax=" + netBufferMax);
}
}
示例4: main
import javax.net.ssl.SSLSession; //导入方法依赖的package包/类
public static void main (String[] args) throws Exception {
SSLContext context = SSLContext.getDefault();
// 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.
if (cliSession.getApplicationBufferSize() < 32768 ||
srvSession.getApplicationBufferSize() < 32768) {
throw new Exception(
"Don't accept large SSL/TLS application data ");
}
}