当前位置: 首页>>代码示例>>Java>>正文


Java SSLServerSocket.setUseClientMode方法代码示例

本文整理汇总了Java中javax.net.ssl.SSLServerSocket.setUseClientMode方法的典型用法代码示例。如果您正苦于以下问题:Java SSLServerSocket.setUseClientMode方法的具体用法?Java SSLServerSocket.setUseClientMode怎么用?Java SSLServerSocket.setUseClientMode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.net.ssl.SSLServerSocket的用法示例。


在下文中一共展示了SSLServerSocket.setUseClientMode方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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_UseClientMode

import javax.net.ssl.SSLServerSocket; //导入方法依赖的package包/类
/**
 * @throws IOException
 * @tests javax.net.ssl.SSLServerSocket#getUseClientMode()
 * @tests javax.net.ssl.SSLServerSocket#setUseClientMode(boolean mode)
 */
@TestTargets({
    @TestTargetNew(
        level = TestLevel.COMPLETE,
        notes = "",
        method = "getUseClientMode",
        args = {}
    ),
    @TestTargetNew(
        level = TestLevel.COMPLETE,
        notes = "",
        method = "setUseClientMode",
        args = {boolean.class}
    )
})
public void test_UseClientMode() throws Exception {
    SSLServerSocket sss = getSSLServerSocket();
    sss.setUseClientMode(false);
    assertFalse(sss.getUseClientMode());
    sss.setUseClientMode(true);
    assertTrue(sss.getUseClientMode());
}
 
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:27,代码来源:SSLServerSocketTest.java

示例3: testSetGetUseClientMode

import javax.net.ssl.SSLServerSocket; //导入方法依赖的package包/类
/**
 * setUseClientMode(boolean mode) method testing.
 * getUseClientMode() method testing.
 */
public void testSetGetUseClientMode() throws Exception {
    SSLServerSocket ssocket = createSSLServerSocket();

    ssocket.setUseClientMode(false);
    assertFalse("Result does not correspond to expected",
            ssocket.getUseClientMode());
    ssocket.setUseClientMode(true);
    assertTrue("Result does not correspond to expected",
            ssocket.getUseClientMode());
}
 
开发者ID:shannah,项目名称:cn1,代码行数:15,代码来源:SSLServerSocketImplTest.java

示例4: doTestInteraction

import javax.net.ssl.SSLServerSocket; //导入方法依赖的package包/类
public void doTestInteraction(SSLContext context, SSLContext ctx_other)
        throws Throwable {
    SSLContext ctx1, ctx2;

    ctx1 = context;
    ctx2 = ctx_other;

    int k=1;

    SSLServerSocket ssocket = (SSLServerSocket) ctx1
        .getServerSocketFactory().createServerSocket(0);
    ssocket.setUseClientMode(false);
    ssocket.setEnabledCipherSuites(
            ((k & 1) > 0)
                ? new String[] {"TLS_"+cipher_suites[0]}
                : new String[] {"SSL_"+cipher_suites[0]});

    SSLSocket csocket = (SSLSocket) ctx2
        .getSocketFactory().createSocket("localhost",
                ssocket.getLocalPort());
    csocket.setEnabledProtocols(new String[] {"TLSv1"});
    csocket.setUseClientMode(true);
    csocket.setEnabledCipherSuites(
            (((k & 2) >> 1) > 0)
                ? new String[] {"TLS_"+cipher_suites[0]}
                : new String[] {"SSL_"+cipher_suites[0]});
    doTest(ssocket, csocket);
}
 
开发者ID:shannah,项目名称:cn1,代码行数:29,代码来源:SSLSocketFunctionalTest.java

示例5: _doTestInteraction

import javax.net.ssl.SSLServerSocket; //导入方法依赖的package包/类
public void _doTestInteraction(SSLContext context, SSLContext ctx_other)
        throws Throwable {
    for (int i=0; i<cipher_suites.length; i++) {
        if (doLog) {
            System.out.println("======== Checking the work on cipher: "
                + cipher_suites[i]);
        }
        SSLContext ctx1, ctx2;
        // k: 00, 01, 10, 11;
        // where 1 means implementation under the test,
        // 0 - another implementation to interract with
        for (int k=0; k<4; k++) {
            if (doLog) {
                System.out.println("======== "+(k & 1)+" "+((k & 2) >> 1));
            }
            ctx1 = ((k & 1) > 0) ? context : ctx_other;
            ctx2 = (((k & 2) >> 1) > 0) ? context : ctx_other;

            SSLServerSocket ssocket = (SSLServerSocket) ctx1
                .getServerSocketFactory().createServerSocket(0);
            ssocket.setUseClientMode(false);
            ssocket.setEnabledCipherSuites(
                    ((k & 1) > 0)
                        ? new String[] {"TLS_"+cipher_suites[i]}
                        : new String[] {"SSL_"+cipher_suites[i]});

            SSLSocket csocket = (SSLSocket) ctx2
                .getSocketFactory().createSocket("localhost",
                        ssocket.getLocalPort());
            csocket.setEnabledProtocols(new String[] {"TLSv1"});
            csocket.setUseClientMode(true);
            csocket.setEnabledCipherSuites(
                    (((k & 2) >> 1) > 0)
                        ? new String[] {"TLS_"+cipher_suites[i]}
                        : new String[] {"SSL_"+cipher_suites[i]});
            doTest(ssocket, csocket);
        }
    }
}
 
开发者ID:shannah,项目名称:cn1,代码行数:40,代码来源:SSLSocketFunctionalTest.java

示例6: doTestSelfInteraction

import javax.net.ssl.SSLServerSocket; //导入方法依赖的package包/类
/**
 * Tests the interaction with other implementation.
 */
public void doTestSelfInteraction(SSLContext context)
        throws Throwable {
    String[] protocols = {"SSLv3", "TLSv1"};
    for (int i=0; i<cipher_suites.length; i++) {
        for (int j=0; j<2; j++) {
            if (doLog) {
                System.out.println("======= " + cipher_suites[i]);
            }
            SSLServerSocket ssocket = (SSLServerSocket) context
                .getServerSocketFactory().createServerSocket(0);
            ssocket.setUseClientMode(false);
            ssocket.setEnabledProtocols(new String[] {protocols[j]});
            ssocket.setEnabledCipherSuites(
                    new String[] {"TLS_"+cipher_suites[i]});

            SSLSocket csocket = (SSLSocket) context
                .getSocketFactory().createSocket("localhost",
                        ssocket.getLocalPort());
            csocket.setEnabledProtocols(new String[] {protocols[j]});
            csocket.setUseClientMode(true);
            csocket.setEnabledCipherSuites(
                    new String[] {"TLS_"+cipher_suites[i]});

            doTest(ssocket, csocket);
        }
    }
}
 
开发者ID:shannah,项目名称:cn1,代码行数:31,代码来源:SSLSocketFunctionalTest.java

示例7: initServerSocket

import javax.net.ssl.SSLServerSocket; //导入方法依赖的package包/类
private void initServerSocket(SSLServerSocket socket) throws IOException {
    socket.setUseClientMode(true);
}
 
开发者ID:chfoo,项目名称:areca-backup-release-mirror,代码行数:4,代码来源:SecuredSocketFactory.java


注:本文中的javax.net.ssl.SSLServerSocket.setUseClientMode方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。