public HttpServer build() throws IOException {

      // Do we still need to assert this non null name if it is deprecated?
      if (this.name == null) {
        throw new HadoopIllegalArgumentException("name is not set");
      }

      // Make the behavior compatible with deprecated interfaces
      if (bindAddress != null && port != -1) {
        try {
          endpoints.add(0, new URI("http", "", bindAddress, port, "", "", ""));
        } catch (URISyntaxException e) {
          throw new HadoopIllegalArgumentException("Invalid endpoint: " + e);
        }
      }

      if (endpoints.isEmpty()) {
        throw new HadoopIllegalArgumentException("No endpoints specified");
      }

      if (hostName == null) {
        hostName = endpoints.get(0).getHost();
      }

      if (this.conf == null) {
        conf = new Configuration();
      }

      HttpServer server = new HttpServer(this);

      for (URI ep : endpoints) {
        ServerConnector listener = null;
        String scheme = ep.getScheme();
        HttpConfiguration httpConfig = new HttpConfiguration();
        httpConfig.setSecureScheme("https");
        httpConfig.setHeaderCacheSize(DEFAULT_MAX_HEADER_SIZE);
        httpConfig.setResponseHeaderSize(DEFAULT_MAX_HEADER_SIZE);
        httpConfig.setRequestHeaderSize(DEFAULT_MAX_HEADER_SIZE);
        httpConfig.setSendServerVersion(false);

        if ("http".equals(scheme)) {
          listener = new ServerConnector(server.webServer, new HttpConnectionFactory(httpConfig));
        } else if ("https".equals(scheme)) {
          HttpConfiguration httpsConfig = new HttpConfiguration(httpConfig);
          httpsConfig.addCustomizer(new SecureRequestCustomizer());
          SslContextFactory.Server sslCtxFactory = new SslContextFactory.Server();
          sslCtxFactory.setNeedClientAuth(needsClientAuth);
          sslCtxFactory.setKeyManagerPassword(keyPassword);

          if (keyStore != null) {
            sslCtxFactory.setKeyStorePath(keyStore);
            sslCtxFactory.setKeyStoreType(keyStoreType);
            sslCtxFactory.setKeyStorePassword(keyStorePassword);
          }

          if (trustStore != null) {
            sslCtxFactory.setTrustStorePath(trustStore);
            sslCtxFactory.setTrustStoreType(trustStoreType);
            sslCtxFactory.setTrustStorePassword(trustStorePassword);
          }

          if (excludeCiphers != null && !excludeCiphers.trim().isEmpty()) {
            sslCtxFactory.setExcludeCipherSuites(StringUtils.getTrimmedStrings(excludeCiphers));
            LOG.debug("Excluded SSL Cipher List:" + excludeCiphers);
          }

          listener = new ServerConnector(server.webServer,
            new SslConnectionFactory(sslCtxFactory, HttpVersion.HTTP_1_1.toString()),
            new HttpConnectionFactory(httpsConfig));
        } else {
          throw new HadoopIllegalArgumentException("unknown scheme for endpoint:" + ep);
        }

        // default settings for connector
        listener.setAcceptQueueSize(128);
        // config idle timeout for jetty
        listener
          .setIdleTimeout(conf.getLong(HTTP_JETTY_IDLE_TIMEOUT, DEFAULT_HTTP_JETTY_IDLE_TIMEOUT));
        if (Shell.WINDOWS) {
          // result of setting the SO_REUSEADDR flag is different on Windows
          // http://msdn.microsoft.com/en-us/library/ms740621(v=vs.85).aspx
          // without this 2 NN's can start on the same machine and listen on
          // the same port with indeterminate routing of incoming requests to them
          listener.setReuseAddress(false);
        }

        listener.setHost(ep.getHost());
        listener.setPort(ep.getPort() == -1 ? 0 : ep.getPort());
        server.addManagedListener(listener);
      }

      server.loadListeners();
      return server;

    }
@see #addEndpoint(URI)
@deprecated Since 0.99.0. Use {@link #addEndpoint(URI)} instead.
hbase-http/src/main/java/org/apache/hadoop/hbase/http/HttpServer.java