protected static String getHost(final String endpoint) {
        try {
            String host = URI.create(endpoint).getHost();
            if (host == null) {
                host = URI.create("http://" + endpoint).getHost();
            }
            if (host == null) {
                return "";
            }
            return host;
        } catch (IllegalArgumentException e) {
            // Couldn't parse this as an endpoint. Assume it's not a valid endpoint, and say that there's no hostname.
            return "";
        }
    }
Parse the host portion out of an endpoint (which may or may not
contain a scheme).

@param endpoint the endpoint to parse
@return the host portion of the endpoint
aws-java-sdk-core/src/main/java/com/amazonaws/regions/AbstractRegionMetadataProvider.java