本文整理匯總了Java中javax.net.ssl.SSLSession.getPacketBufferSize方法的典型用法代碼示例。如果您正苦於以下問題:Java SSLSession.getPacketBufferSize方法的具體用法?Java SSLSession.getPacketBufferSize怎麽用?Java SSLSession.getPacketBufferSize使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javax.net.ssl.SSLSession
的用法示例。
在下文中一共展示了SSLSession.getPacketBufferSize方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: createBuffers
import javax.net.ssl.SSLSession; //導入方法依賴的package包/類
protected void createBuffers( SSLSession session ) {
int netBufferMax = session.getPacketBufferSize();
int appBufferMax = Math.max(session.getApplicationBufferSize(), netBufferMax);
if( inData == null ) {
inData = ByteBuffer.allocate( appBufferMax );
outCrypt = ByteBuffer.allocate( netBufferMax );
inCrypt = ByteBuffer.allocate( netBufferMax );
} else {
if( inData.capacity() != appBufferMax )
inData = ByteBuffer.allocate( appBufferMax );
if( outCrypt.capacity() != netBufferMax )
outCrypt = ByteBuffer.allocate( netBufferMax );
if( inCrypt.capacity() != netBufferMax )
inCrypt = ByteBuffer.allocate( netBufferMax );
}
inData.rewind();
inData.flip();
inCrypt.rewind();
inCrypt.flip();
outCrypt.rewind();
outCrypt.flip();
bufferallocations++;
}
示例2: 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();
}
示例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: 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);
}
}
示例5: createBuffers
import javax.net.ssl.SSLSession; //導入方法依賴的package包/類
protected void createBuffers(SSLSession session) {
int netBufferMax = session.getPacketBufferSize();
int appBufferMax = Math.max(session.getApplicationBufferSize(), netBufferMax);
if (inData == null) {
inData = ByteBuffer.allocate(appBufferMax);
outCrypt = ByteBuffer.allocate(netBufferMax);
inCrypt = ByteBuffer.allocate(netBufferMax);
} else {
if (inData.capacity() != appBufferMax) {
inData = ByteBuffer.allocate(appBufferMax);
}
if (outCrypt.capacity() != netBufferMax) {
outCrypt = ByteBuffer.allocate(netBufferMax);
}
if (inCrypt.capacity() != netBufferMax) {
inCrypt = ByteBuffer.allocate(netBufferMax);
}
}
inData.rewind();
inData.flip();
inCrypt.rewind();
inCrypt.flip();
outCrypt.rewind();
outCrypt.flip();
bufferallocations++;
}
示例6: 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 ");
}
}