当前位置: 首页>>代码示例>>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;未经允许,请勿转载。