|
|
|
@ -71,9 +71,16 @@ public class URIBuilder {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static String trimIpv6Brackets(String host) {
|
|
|
|
|
if (host.startsWith("[") && host.endsWith("]")) {
|
|
|
|
|
return host.substring(1, host.length() - 1);
|
|
|
|
|
}
|
|
|
|
|
return host;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static boolean compare(InetSocketAddress entryAddr, URI addr) {
|
|
|
|
|
if (((entryAddr.getHostName() != null && entryAddr.getHostName().equals(addr.getHost()))
|
|
|
|
|
|| entryAddr.getAddress().getHostAddress().equals(addr.getHost()))
|
|
|
|
|
if (((entryAddr.getHostName() != null && entryAddr.getHostName().equals(trimIpv6Brackets(addr.getHost())))
|
|
|
|
|
|| entryAddr.getAddress().getHostAddress().equals(trimIpv6Brackets(addr.getHost())))
|
|
|
|
|
&& entryAddr.getPort() == addr.getPort()) {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|