@Test void getInetSocket_withNoPort() throws java.net.URISyntaxException { InetSocketAddress result = XUrl.inetSocket(url1); assertEquals("api.nordstrom.com", result.getHostString()); assertEquals(443, result.getPort()); }
public static InetSocketAddress inetSocket(String url) throws URISyntaxException { Preconditions.checkNotNull(url); Matcher matcher = URL_PROTOCOL_REGEX.matcher(url); url = addProtocol(url); URI uri = new URI(url); if (uri.getPort() == -1) { if (!matcher.find()) { return new InetSocketAddress(uri.getHost(), 80); } else { return new InetSocketAddress(uri.getHost(), 443); } } else { return new InetSocketAddress(uri.getHost(), uri.getPort()); } }
XUrl { public static InetSocketAddress inetSocket(String url) throws URISyntaxException { Preconditions.checkNotNull(url); Matcher matcher = URL_PROTOCOL_REGEX.matcher(url); url = addProtocol(url); URI uri = new URI(url); if (uri.getPort() == -1) { if (!matcher.find()) { return new InetSocketAddress(uri.getHost(), 80); } else { return new InetSocketAddress(uri.getHost(), 443); } } else { return new InetSocketAddress(uri.getHost(), uri.getPort()); } } }
XUrl { public static InetSocketAddress inetSocket(String url) throws URISyntaxException { Preconditions.checkNotNull(url); Matcher matcher = URL_PROTOCOL_REGEX.matcher(url); url = addProtocol(url); URI uri = new URI(url); if (uri.getPort() == -1) { if (!matcher.find()) { return new InetSocketAddress(uri.getHost(), 80); } else { return new InetSocketAddress(uri.getHost(), 443); } } else { return new InetSocketAddress(uri.getHost(), uri.getPort()); } }  }
XUrl { public static InetSocketAddress inetSocket(String url) throws URISyntaxException { Preconditions.checkNotNull(url); Matcher matcher = URL_PROTOCOL_REGEX.matcher(url); url = addProtocol(url); URI uri = new URI(url); if (uri.getPort() == -1) { if (!matcher.find()) { return new InetSocketAddress(uri.getHost(), 80); } else { return new InetSocketAddress(uri.getHost(), 443); } } else { return new InetSocketAddress(uri.getHost(), uri.getPort()); } }  static String host(String url); static int port(String url); static String domainChecked(String url); static String path(String url); static String stripUrlParameters(String url); static String stripUrlParameters(URL url); static String rawQueryParameters(String url); static String addProtocol(String url); static Map<String, List<String>> decodeQueryString(String url); static InetSocketAddress inetSocket(String url); }
XUrl { public static InetSocketAddress inetSocket(String url) throws URISyntaxException { Preconditions.checkNotNull(url); Matcher matcher = URL_PROTOCOL_REGEX.matcher(url); url = addProtocol(url); URI uri = new URI(url); if (uri.getPort() == -1) { if (!matcher.find()) { return new InetSocketAddress(uri.getHost(), 80); } else { return new InetSocketAddress(uri.getHost(), 443); } } else { return new InetSocketAddress(uri.getHost(), uri.getPort()); } }  static String host(String url); static int port(String url); static String domainChecked(String url); static String path(String url); static String stripUrlParameters(String url); static String stripUrlParameters(URL url); static String rawQueryParameters(String url); static String addProtocol(String url); static Map<String, List<String>> decodeQueryString(String url); static InetSocketAddress inetSocket(String url);  }