@SuppressWarnings("deprecation")
  private ServerConnector createSelectChannelConnectorForAgent(Server server, int port, boolean needClientAuth, int acceptors) {
    Map<String, String> configsMap = configs.getConfigsMap();
    ServerConnector agentConnector;

    if (configs.getAgentSSLAuthentication()) {
      String keystore = configsMap.get(Configuration.SRVR_KSTR_DIR.getKey()) + File.separator
        + configsMap.get(Configuration.KSTR_NAME.getKey());

      String truststore = configsMap.get(Configuration.SRVR_KSTR_DIR.getKey()) + File.separator
        + configsMap.get(Configuration.TSTR_NAME.getKey());

      String srvrCrtPass = configsMap.get(Configuration.SRVR_CRT_PASS.getKey());

      SecureRequestCustomizer src = new SecureRequestCustomizer();
      src.setSniHostCheck(false);
      src.setSniRequired(false);
      HttpConfiguration https_config = new HttpConfiguration();
      https_config.addCustomizer(src);
      https_config.setRequestHeaderSize(configs.getHttpRequestHeaderSize());
      https_config.setResponseHeaderSize(configs.getHttpResponseHeaderSize());
      https_config.setSendServerVersion(false);

      // Secured connector - default constructor sets trustAll = true for certs
      SslContextFactory.Server sslContextFactory = new SslContextFactory.Server();
      disableInsecureProtocols(sslContextFactory);
      sslContextFactory.setKeyStorePath(keystore);
      sslContextFactory.setTrustStorePath(truststore);
      sslContextFactory.setKeyStorePassword(srvrCrtPass);
      sslContextFactory.setKeyManagerPassword(srvrCrtPass);
      sslContextFactory.setTrustStorePassword(srvrCrtPass);
      sslContextFactory.setKeyStoreType(configsMap.get(Configuration.KSTR_TYPE.getKey()));
      sslContextFactory.setTrustStoreType(configsMap.get(Configuration.TSTR_TYPE.getKey()));
      sslContextFactory.setNeedClientAuth(needClientAuth);
      sslContextFactory.setSniRequired(false);

      ServerConnector agentSslConnector = new ServerConnector(server, acceptors, -1,
        new SslConnectionFactory(sslContextFactory, HttpVersion.HTTP_1_1.toString()),
        new HttpConnectionFactory(https_config));
      agentConnector = agentSslConnector;
    } else {
      agentConnector = new ServerConnector(server, acceptors, -1);
      agentConnector.setIdleTimeout(configs.getConnectionMaxIdleTime());
    }

    agentConnector.setPort(port);

    return agentConnector;
  }
Create org.eclipse.jetty.server.nio.SelectChannelConnector
implementation for SSL or non-SSL based on configuration.

@param port connector port
@param needClientAuth one-way / two-way SSL
@return org.eclipse.jetty.server.nio.SelectChannelConnector
ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariServer.java