Netty needs an explicit port so resolve that from the endpoint provided.

@param endpoint Configured endpoint
@return Port number to use.
481765
private int getPort(URI endpoint) {
        if (endpoint.getPort() != -1) {
            return endpoint.getPort();
        } else if ("https".equals(endpoint.getScheme())) {
            return 443;
        } else {
            return 80;
        }
    }
356019
def parse_endpoint(inputendpoint_xml)
      hash = Hash.new
      %w{LoadBalancedEndpointSetName LocalPort Name Port Protocol EnableDirectServerReturn LoadBalancerName IdleTimeoutInMinutes}.each do |key|
        hash[key] = xml_content(inputendpoint_xml, key, nil)
      end
      # Protocol could be in there twice... If we have two, pick the second one as the first is for the probe.
      if inputendpoint_xml.css("Protocol").count > 1
        hash["Protocol"] = inputendpoint_xml.css("Protocol")[1].content
      end
      probe = inputendpoint_xml.css("LoadBalancerProbe")
      if probe
        hash["LoadBalancerProbe"] = Hash.new
        %w{Path Port Protocol IntervalInSeconds TimeoutInSeconds}.each do |key|
          hash["LoadBalancerProbe"][key] = xml_content(probe, key, nil)
        end
      end
      hash
    end
1232091
function ApiClient(endpoint) {
    if (endpoint.length > 0 && endpoint.slice(-1) != "/") {
        endpoint += "/";
    }
    
    this.endpoint = endpoint;
    this.namespace = null;
}
23390
public static String decodeEndpointURI(String endpoint) {
        int ind=endpoint.indexOf('[');
        if (ind == 0) {
            return null;
        } else if (ind != -1) {
            return endpoint.substring(0, ind);
        }
        return endpoint;
    }
757554
public java.rmi.Remote getPort(Class serviceEndpointInterface) throws javax.xml.rpc.ServiceException {
        try {
            if (com.google.api.ads.admanager.axis.v201805.BaseRateServiceInterface.class.isAssignableFrom(serviceEndpointInterface)) {
                com.google.api.ads.admanager.axis.v201805.BaseRateServiceSoapBindingStub _stub = new com.google.api.ads.admanager.axis.v201805.BaseRateServiceSoapBindingStub(new java.net.URL(BaseRateServiceInterfacePort_address), this);
                _stub.setPortName(getBaseRateServiceInterfacePortWSDDServiceName());
                return _stub;
            }
        }
        catch (java.lang.Throwable t) {
            throw new javax.xml.rpc.ServiceException(t);
        }
        throw new javax.xml.rpc.ServiceException("There is no stub implementation for the interface:  " + (serviceEndpointInterface == null ? "null" : serviceEndpointInterface.getName()));
    }
935756
public java.rmi.Remote getPort(Class serviceEndpointInterface) throws javax.xml.rpc.ServiceException {
        try {
            if (com.google.api.ads.admanager.axis.v201808.ProposalLineItemServiceInterface.class.isAssignableFrom(serviceEndpointInterface)) {
                com.google.api.ads.admanager.axis.v201808.ProposalLineItemServiceSoapBindingStub _stub = new com.google.api.ads.admanager.axis.v201808.ProposalLineItemServiceSoapBindingStub(new java.net.URL(ProposalLineItemServiceInterfacePort_address), this);
                _stub.setPortName(getProposalLineItemServiceInterfacePortWSDDServiceName());
                return _stub;
            }
        }
        catch (java.lang.Throwable t) {
            throw new javax.xml.rpc.ServiceException(t);
        }
        throw new javax.xml.rpc.ServiceException("There is no stub implementation for the interface:  " + (serviceEndpointInterface == null ? "null" : serviceEndpointInterface.getName()));
    }
228786
public java.rmi.Remote getPort(Class serviceEndpointInterface) throws javax.xml.rpc.ServiceException {
        try {
            if (com.google.api.ads.admanager.axis.v201805.ProductPackageItemServiceInterface.class.isAssignableFrom(serviceEndpointInterface)) {
                com.google.api.ads.admanager.axis.v201805.ProductPackageItemServiceSoapBindingStub _stub = new com.google.api.ads.admanager.axis.v201805.ProductPackageItemServiceSoapBindingStub(new java.net.URL(ProductPackageItemServiceInterfacePort_address), this);
                _stub.setPortName(getProductPackageItemServiceInterfacePortWSDDServiceName());
                return _stub;
            }
        }
        catch (java.lang.Throwable t) {
            throw new javax.xml.rpc.ServiceException(t);
        }
        throw new javax.xml.rpc.ServiceException("There is no stub implementation for the interface:  " + (serviceEndpointInterface == null ? "null" : serviceEndpointInterface.getName()));
    }
507227
public java.rmi.Remote getPort(Class serviceEndpointInterface) throws javax.xml.rpc.ServiceException {
        try {
            if (com.google.api.ads.adwords.axis.v201809.cm.DataServiceInterface.class.isAssignableFrom(serviceEndpointInterface)) {
                com.google.api.ads.adwords.axis.v201809.cm.DataServiceSoapBindingStub _stub = new com.google.api.ads.adwords.axis.v201809.cm.DataServiceSoapBindingStub(new java.net.URL(DataServiceInterfacePort_address), this);
                _stub.setPortName(getDataServiceInterfacePortWSDDServiceName());
                return _stub;
            }
        }
        catch (java.lang.Throwable t) {
            throw new javax.xml.rpc.ServiceException(t);
        }
        throw new javax.xml.rpc.ServiceException("There is no stub implementation for the interface:  " + (serviceEndpointInterface == null ? "null" : serviceEndpointInterface.getName()));
    }
639993
public java.rmi.Remote getPort(Class serviceEndpointInterface) throws javax.xml.rpc.ServiceException {
        try {
            if (com.google.api.ads.adwords.axis.v201809.cm.LocationCriterionServiceInterface.class.isAssignableFrom(serviceEndpointInterface)) {
                com.google.api.ads.adwords.axis.v201809.cm.LocationCriterionServiceSoapBindingStub _stub = new com.google.api.ads.adwords.axis.v201809.cm.LocationCriterionServiceSoapBindingStub(new java.net.URL(LocationCriterionServiceInterfacePort_address), this);
                _stub.setPortName(getLocationCriterionServiceInterfacePortWSDDServiceName());
                return _stub;
            }
        }
        catch (java.lang.Throwable t) {
            throw new javax.xml.rpc.ServiceException(t);
        }
        throw new javax.xml.rpc.ServiceException("There is no stub implementation for the interface:  " + (serviceEndpointInterface == null ? "null" : serviceEndpointInterface.getName()));
    }
311449
@Deprecated
    public static Endpoint of(String host, int port, int weight) {
        return of(host, port).withWeight(weight);
    }
1309526
def getEndpoint(self):
        
        port = ''
        endpoint = ''
        keyConfig = self.getKeyConfig()
        if 'port' in keyConfig:
            port = ':' + keyConfig['port']
        elif self._data['port'] != self.PORT:
            port = ':' + self._data['port']
        if 'endpoint' in keyConfig:
            endpoint = keyConfig['endpoint']
        else:
            endpoint = self._data['endpoint']
        return 'https://%s%s/%s/' % (endpoint,
                                     port,
                                     self._data['api_version'])
1220582
public EndpointConfig resolveEndpointConfig() {
      final String endpointClassName = getEndpointClassName();
      // 1) default values
      //String configName = org.jboss.wsf.spi.metadata.config.EndpointConfig.STANDARD_ENDPOINT_CONFIG;
      String configName = endpointClassName;
      String configFile = EndpointConfig.DEFAULT_ENDPOINT_CONFIG_FILE;
      boolean specifiedConfig = false;
      // 2) annotation contribution
      if (isEndpointClassAnnotated(org.jboss.ws.api.annotation.EndpointConfig.class))
      {
         final String cfgName = getEndpointConfigNameFromAnnotation();
         if (cfgName != null && !cfgName.isEmpty())
         {
            configName = cfgName;
         }
         final String cfgFile = getEndpointConfigFileFromAnnotation();
         if (cfgFile != null && !cfgFile.isEmpty())
         {
            configFile = cfgFile;
         }
         specifiedConfig = true;
      }
      // 3) descriptor overrides (jboss-webservices.xml or web.xml)
      final String epCfgNameOverride = getEndpointConfigNameOverride();
      if (epCfgNameOverride != null && !epCfgNameOverride.isEmpty())
      {
         configName = epCfgNameOverride;
         specifiedConfig = true;
      }
      final String epCfgFileOverride = getEndpointConfigFileOverride();
      if (epCfgFileOverride != null && !epCfgFileOverride.isEmpty())
      {
         configFile = epCfgFileOverride;
      }
      // 4) setup of configuration
      if (configFile != EndpointConfig.DEFAULT_ENDPOINT_CONFIG_FILE) {
         //look for provided endpoint config file
         try
         {
            ConfigRoot configRoot = ConfigMetaDataParser.parse(getConfigFile(configFile));
            EndpointConfig config = configRoot.getEndpointConfigByName(configName);
            if (config == null && !specifiedConfig) {
               config = configRoot.getEndpointConfigByName(EndpointConfig.STANDARD_ENDPOINT_CONFIG);
            }
            if (config != null) {
               return config;
            }
         }
         catch (IOException e)
         {
            throw Messages.MESSAGES.couldNotReadConfigFile(configFile);
         }
      }
      else
      {
         EndpointConfig config = null;
         URL url = getDefaultConfigFile(configFile);
         if (url != null) {
            //the default file exists
            try
            {
               ConfigRoot configRoot = ConfigMetaDataParser.parse(url);
               config = configRoot.getEndpointConfigByName(configName);
               if (config == null && !specifiedConfig) {
                  config = configRoot.getEndpointConfigByName(EndpointConfig.STANDARD_ENDPOINT_CONFIG);
               }
            }
            catch (IOException e)
            {
               throw Messages.MESSAGES.couldNotReadConfigFile(configFile);
            }
         }
         if (config == null) {
            //use endpoint configs from AS domain
            ServerConfig sc = getServerConfig();
            config = sc.getEndpointConfig(configName);
            if (config == null && !specifiedConfig) {
               config = sc.getEndpointConfig(EndpointConfig.STANDARD_ENDPOINT_CONFIG);
            }
            if (config == null && specifiedConfig) {
                throw Messages.MESSAGES.couldNotFindEndpointConfigName(configName);
            }
         }
         if (config != null) {
            return config;
         } 
      }
      return null;
   }
533213
public static URI toUri(String endpoint, Protocol protocol) {
        if (endpoint == null) {
            throw new IllegalArgumentException("endpoint cannot be null");
        }

        /*
         * If the endpoint doesn't explicitly specify a protocol to use, then
         * we'll defer to the default protocol specified in the client
         * configuration.
         */
        if (!endpoint.contains("://")) {
            endpoint = protocol.toString() + "://" + endpoint;
        }

        try {
            return new URI(endpoint);
        } catch (URISyntaxException e) {
            throw new IllegalArgumentException(e);
        }
    }
82103
private Integer getPort(String resourcePath, FtpEndpointConfiguration endpointConfiguration) {
        if (resourcePath.contains(":")) {
            return Integer.valueOf(resourcePath.split(":")[1]);
        }

        return endpointConfiguration.getPort();
    }
334416
@Override
    public int getServerPort() {
        int port = this.request.getVirtualPort();
        if (-1 == port && null != this.request.getHeader("Host")) {
            // if Host is present, default to scheme
            if ("HTTP".equalsIgnoreCase(this.request.getScheme())) {
                port = 80;
            } else {
                port = 443;
            }
        }
        // if still not found, use the socket information
        if (-1 == port) {
            port = this.connection.getLocalPort();
        }
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
            Tr.debug(tc, "getServerPort: " + port);
        }
        return port;
    }
769918
public java.rmi.Remote getPort(Class serviceEndpointInterface) throws javax.xml.rpc.ServiceException {
        try {
            if (com.google.api.ads.admanager.axis.v201902.OrderServiceInterface.class.isAssignableFrom(serviceEndpointInterface)) {
                com.google.api.ads.admanager.axis.v201902.OrderServiceSoapBindingStub _stub = new com.google.api.ads.admanager.axis.v201902.OrderServiceSoapBindingStub(new java.net.URL(OrderServiceInterfacePort_address), this);
                _stub.setPortName(getOrderServiceInterfacePortWSDDServiceName());
                return _stub;
            }
        }
        catch (java.lang.Throwable t) {
            throw new javax.xml.rpc.ServiceException(t);
        }
        throw new javax.xml.rpc.ServiceException("There is no stub implementation for the interface:  " + (serviceEndpointInterface == null ? "null" : serviceEndpointInterface.getName()));
    }
951576
public static PortType createPortType(StringType namespace, StringType name, StringType address) {
        PortType endpointType = new PortType();
        endpointType.namespace = namespace;
        endpointType.name = name;
        endpointType.address = address;
        return endpointType;

    }