Endpoint implements Comparable<Endpoint>, EndpointGroup { @Override public String toString() { return strVal; } private  Endpoint(String host, @Nullable String ipAddr, int port, int weight, HostType hostType); static Endpoint parse(String authority); static Endpoint of(String host, int port); static Endpoint of(String host); @Override List<Endpoint> endpoints(); @Override EndpointSelectionStrategy selectionStrategy(); @Override Endpoint selectNow(ClientRequestContext ctx); @Override CompletableFuture<Endpoint> select(ClientRequestContext ctx,
                                              ScheduledExecutorService executor,
                                              long timeoutMillis); @Override CompletableFuture<List<Endpoint>> whenReady(); String host(); @Nullable String ipAddr(); boolean hasIpAddr(); boolean isIpAddrOnly(); @Nullable StandardProtocolFamily ipFamily(); int port(); int port(int defaultValue); boolean hasPort(); Endpoint withPort(int port); Endpoint withoutPort(); Endpoint withDefaultPort(int defaultPort); Endpoint withoutDefaultPort(int defaultPort); Endpoint withIpAddr(@Nullable String ipAddr); Endpoint withWeight(int weight); int weight(); String authority(); URI toUri(String scheme); URI toUri(String scheme, @Nullable String path); URI toUri(SessionProtocol sessionProtocol); URI toUri(SessionProtocol sessionProtocol, @Nullable String path); URI toUri(Scheme scheme); URI toUri(Scheme scheme, @Nullable String path); @Override CompletableFuture<?> closeAsync(); @Override void close(); @Override boolean equals(@Nullable Object obj); @Override int hashCode(); @Override int compareTo(Endpoint that); @Override String toString();  }
@Test void testToString() { assertThat(Endpoint.of("a").toString()).isEqualTo("Endpoint{a, weight=1000}"); assertThat(Endpoint.of("a", 80).toString()).isEqualTo("Endpoint{a:80, weight=1000}"); assertThat(Endpoint.of("a").withIpAddr("::1").toString()) .isEqualTo("Endpoint{a, ipAddr=::1, weight=1000}"); assertThat(Endpoint.of("127.0.0.1").toString()).isEqualTo("Endpoint{127.0.0.1, weight=1000}"); assertThat(Endpoint.of("::1").toString()).isEqualTo("Endpoint{[::1], weight=1000}"); }