code: private int getPort(URI endpoint) {
          if (endpoint.getPort() != -1) {
              return endpoint.getPort();
          } else if ("https".equals(endpoint.getScheme())) {
              return 443;
          } else {
              return 80;
          }
      }
docs: Netty needs an explicit port so resolve that from the endpoint provided.
  
  @param endpoint Configured endpoint
  @return Port number to use.