} catch (UnknownHostException uhe) {
// Name resolution failed.
// We'll just try to use the host name later anyway.
}
DiscoveryConstraints dc = DiscoveryConstraints.process(constraints);
int pv = dc.chooseProtocolVersion();
Discovery disco;
switch (pv) {
case Discovery.PROTOCOL_VERSION_1:
disco = Discovery.getProtocol1();
break;
case Discovery.PROTOCOL_VERSION_2:
disco = Discovery.getProtocol2(null);
break;
default:
throw new AssertionError(pv);
}
long deadline = dc.getConnectionDeadline(Long.MAX_VALUE);
long connectionTimeout = getTimeout(deadline);
if (addrs == null) {
return getSingleResponse(host, connectionTimeout, port, dc, disco);
}