當前位置: 首頁>>代碼示例>>Java>>正文


Java SSLServerSocket.setEnableSessionCreation方法代碼示例

本文整理匯總了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);
  }
}
 
開發者ID:ampool,項目名稱:monarch,代碼行數:23,代碼來源:SocketCreator.java

示例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());
}
 
開發者ID:keplersj,項目名稱:In-the-Box-Fork,代碼行數:28,代碼來源:SSLServerSocketTest.java

示例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;
}
 
開發者ID:geronimo-iia,項目名稱:winstone,代碼行數:18,代碼來源:HttpsListener.java

示例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());
}
 
開發者ID:shannah,項目名稱:cn1,代碼行數:15,代碼來源:SSLServerSocketImplTest.java


注:本文中的javax.net.ssl.SSLServerSocket.setEnableSessionCreation方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。