@Test public void should_recognise_ipv4_literal() { assertThat(subject.isLiteralIpAddress("10.0.0.10")).hasValue("10.0.0.10"); assertThat(subject.isLiteralIpAddress("127.0.0.1")).hasValue("127.0.0.1"); assertThat(subject.isLiteralIpAddress("567.0.0.1")).hasValue("567.0.0.1"); }
Optional<String> isLiteralIpAddress(String host) { if (isLiteralV4Address(host)) return Optional.of(host); else if (host.contains(":")) { final Matcher matcher = IPV6_ADDRESS_PATTERN.matcher(host); if (matcher.matches()) return Optional.of(matcher.group(1)); } return Optional.empty(); }
HappyEyeballsResolver implements SocketAddressResolver { Optional<String> isLiteralIpAddress(String host) { if (isLiteralV4Address(host)) return Optional.of(host); else if (host.contains(":")) { final Matcher matcher = IPV6_ADDRESS_PATTERN.matcher(host); if (matcher.matches()) return Optional.of(matcher.group(1)); } return Optional.empty(); } }
HappyEyeballsResolver implements SocketAddressResolver { Optional<String> isLiteralIpAddress(String host) { if (isLiteralV4Address(host)) return Optional.of(host); else if (host.contains(":")) { final Matcher matcher = IPV6_ADDRESS_PATTERN.matcher(host); if (matcher.matches()) return Optional.of(matcher.group(1)); } return Optional.empty(); } HappyEyeballsResolver(HttpClient httpClient); }
HappyEyeballsResolver implements SocketAddressResolver { Optional<String> isLiteralIpAddress(String host) { if (isLiteralV4Address(host)) return Optional.of(host); else if (host.contains(":")) { final Matcher matcher = IPV6_ADDRESS_PATTERN.matcher(host); if (matcher.matches()) return Optional.of(matcher.group(1)); } return Optional.empty(); } HappyEyeballsResolver(HttpClient httpClient); @Override void resolve(String host, int port, Promise<List<InetSocketAddress>> promise); }
HappyEyeballsResolver implements SocketAddressResolver { Optional<String> isLiteralIpAddress(String host) { if (isLiteralV4Address(host)) return Optional.of(host); else if (host.contains(":")) { final Matcher matcher = IPV6_ADDRESS_PATTERN.matcher(host); if (matcher.matches()) return Optional.of(matcher.group(1)); } return Optional.empty(); } HappyEyeballsResolver(HttpClient httpClient); @Override void resolve(String host, int port, Promise<List<InetSocketAddress>> promise); static final long HAPPY_EYEBALLS_TOTAL_TIMEOUT_NANOS; }