private ServerCnxnFactory createServerCnxnFactory(int currentClientPort) throws IOException {
    ServerCnxnFactory serverCnxnFactory = null;
    if (sslEnabled) {
      System.setProperty(ServerCnxnFactory.ZOOKEEPER_SERVER_CNXN_FACTORY,
          "org.apache.zookeeper.server.NettyServerCnxnFactory");
      String dataFileDir = !System.getProperty("test.data.files", "").isEmpty() ?
              System.getProperty("test.data.files") :
              configuration.get("test.data.files").replace('\\', '/').replace("c:", "");
      X509Util x509Util = new ClientX509Util();
      System.setProperty(x509Util.getSslKeystoreLocationProperty(),
          dataFileDir + File.separator + LOCALHOST_KEY_STORE_NAME);
      System.setProperty(x509Util.getSslKeystorePasswdProperty(),
          KEY_STORE_TRUST_STORE_PASSWORD);
      System.setProperty(x509Util.getSslTruststoreLocationProperty(),
          dataFileDir + File.separator + TRUST_STORE_NAME);
      System.setProperty(x509Util.getSslTruststorePasswdProperty(),
          KEY_STORE_TRUST_STORE_PASSWORD);
      serverCnxnFactory = ServerCnxnFactory.createFactory();
      serverCnxnFactory.configure(new InetSocketAddress(currentClientPort),
          configuration.getInt(HConstants.ZOOKEEPER_MAX_CLIENT_CNXNS, HConstants.DEFAULT_ZOOKEPER_MAX_CLIENT_CNXNS),
          -1,true);
    } else {
      serverCnxnFactory = ServerCnxnFactory.createFactory();
      serverCnxnFactory.configure(new InetSocketAddress(currentClientPort),
          configuration.getInt(HConstants.ZOOKEEPER_MAX_CLIENT_CNXNS, HConstants.DEFAULT_ZOOKEPER_MAX_CLIENT_CNXNS));
    }
    return serverCnxnFactory;
  }
@param baseDir
@param numZooKeeperServers
@return ClientPort server bound to, -1 if there was a
        binding problem and we couldn't pick another port.
@throws IOException
@throws InterruptedException
ql/src/test/org/apache/hive/testutils/MiniZooKeeperCluster.java