use of com.google.common.net.HostAndPort in project tesla by linking12.
the class ProxyToServerConnection method addressFor.
public static InetSocketAddress addressFor(String hostAndPort, HttpProxyServer proxyServer) throws UnknownHostException {
HostAndPort parsedHostAndPort;
try {
parsedHostAndPort = HostAndPort.fromString(hostAndPort);
} catch (IllegalArgumentException e) {
throw new UnknownHostException(hostAndPort);
}
String host = parsedHostAndPort.getHost();
int port = parsedHostAndPort.getPortOrDefault(80);
return proxyServer.getServerResolver().resolve(host, port);
}
Aggregations