SSLAuthTest.java 文件源码

java
阅读 36 收藏 0 点赞 0 评论 0

项目:https-github.com-apache-zookeeper 作者:
@Before
public void setUp() throws Exception {
    String testDataPath = System.getProperty("test.data.dir", "build/test/data");
    System.setProperty(ServerCnxnFactory.ZOOKEEPER_SERVER_CNXN_FACTORY, "org.apache.zookeeper.server.NettyServerCnxnFactory");
    System.setProperty(ZKClientConfig.ZOOKEEPER_CLIENT_CNXN_SOCKET, "org.apache.zookeeper.ClientCnxnSocketNetty");
    System.setProperty(ZKClientConfig.SECURE_CLIENT, "true");
    System.setProperty(ZKConfig.SSL_AUTHPROVIDER, "x509");
    System.setProperty(ZKConfig.SSL_KEYSTORE_LOCATION, testDataPath + "/ssl/testKeyStore.jks");
    System.setProperty(ZKConfig.SSL_KEYSTORE_PASSWD, "testpass");
    System.setProperty(ZKConfig.SSL_TRUSTSTORE_LOCATION, testDataPath + "/ssl/testTrustStore.jks");
    System.setProperty(ZKConfig.SSL_TRUSTSTORE_PASSWD, "testpass");
    System.setProperty("javax.net.debug", "ssl");
    System.setProperty("zookeeper.authProvider.x509", "org.apache.zookeeper.server.auth.X509AuthenticationProvider");

    String host = "localhost";
    int port = PortAssignment.unique();
    hostPort = host + ":" + port;

    serverFactory = ServerCnxnFactory.createFactory();
    serverFactory.configure(new InetSocketAddress(host, port), maxCnxns, true);

    super.setUp();
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号