本文整理匯總了Java中javax.net.ssl.SSLServerSocket.setEnableSessionCreation方法的典型用法代碼示例。如果您正苦於以下問題:Java SSLServerSocket.setEnableSessionCreation方法的具體用法?Java SSLServerSocket.setEnableSessionCreation怎麽用?Java SSLServerSocket.setEnableSessionCreation使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javax.net.ssl.SSLServerSocket
的用法示例。
在下文中一共展示了SSLServerSocket.setEnableSessionCreation方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: finishServerSocket
import javax.net.ssl.SSLServerSocket; //導入方法依賴的package包/類
/**
* Configure the SSLServerSocket based on this SocketCreator's settings.
*/
private void finishServerSocket(SSLServerSocket serverSocket) throws IOException {
serverSocket.setUseClientMode(false);
if (this.sslConfig.isRequireAuth()) {
// serverSocket.setWantClientAuth( true );
serverSocket.setNeedClientAuth(true);
}
serverSocket.setEnableSessionCreation(true);
// restrict protocols
String[] protocols = this.sslConfig.getProtocolsAsStringArray();
if (!"any".equalsIgnoreCase(protocols[0])) {
serverSocket.setEnabledProtocols(protocols);
}
// restrict ciphers
String[] ciphers = this.sslConfig.getCiphersAsStringArray();
if (!"any".equalsIgnoreCase(ciphers[0])) {
serverSocket.setEnabledCipherSuites(ciphers);
}
}
示例2: test_EnableSessionCreation
import javax.net.ssl.SSLServerSocket; //導入方法依賴的package包/類
/**
* @throws IOException
* @tests javax.net.ssl.SSLServerSocket#setEnableSessionCreation(boolean flag)
* @tests javax.net.ssl.SSLServerSocket#getEnableSessionCreation()
*/
@TestTargets({
@TestTargetNew(
level = TestLevel.COMPLETE,
notes = "",
method = "getEnableSessionCreation",
args = {}
),
@TestTargetNew(
level = TestLevel.COMPLETE,
notes = "",
method = "setEnableSessionCreation",
args = {boolean.class}
)
})
public void test_EnableSessionCreation() throws Exception {
SSLServerSocket sss = getSSLServerSocket();
assertTrue(sss.getEnableSessionCreation());
sss.setEnableSessionCreation(false);
assertFalse(sss.getEnableSessionCreation());
sss.setEnableSessionCreation(true);
assertTrue(sss.getEnableSessionCreation());
}
示例3: getServerSocket
import javax.net.ssl.SSLServerSocket; //導入方法依賴的package包/類
/**
* Gets a server socket - this gets as SSL socket instead of the standard
* socket returned in the base class.
*/
@Override
protected ServerSocket getServerSocket() throws IOException {
// Just to make sure it's set before we start
final SSLContext context = getSSLContext();
final SSLServerSocketFactory factory = context.getServerSocketFactory();
final SSLServerSocket ss = (SSLServerSocket) (listenAddress == null ? factory.createServerSocket(listenPort, HttpListener.BACKLOG_COUNT) : factory.createServerSocket(listenPort, HttpListener.BACKLOG_COUNT,
InetAddress.getByName(listenAddress)));
ss.setEnableSessionCreation(Boolean.TRUE);
if (performClientAuth) {
ss.setNeedClientAuth(Boolean.TRUE);
}
return ss;
}
示例4: testSetGetEnableSessionCreation
import javax.net.ssl.SSLServerSocket; //導入方法依賴的package包/類
/**
* setEnableSessionCreation(boolean flag) method testing.
* getEnableSessionCreation() method testing.
*/
public void testSetGetEnableSessionCreation() throws Exception {
SSLServerSocket ssocket = createSSLServerSocket();
ssocket.setEnableSessionCreation(false);
assertFalse("Result does not correspond to expected",
ssocket.getEnableSessionCreation());
ssocket.setEnableSessionCreation(true);
assertTrue("Result does not correspond to expected",
ssocket.getEnableSessionCreation());
}