okhttp3.Dns.lookup()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(3.4k)|赞(0)|评价(0)|浏览(496)

本文整理了Java中okhttp3.Dns.lookup()方法的一些代码示例,展示了Dns.lookup()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Dns.lookup()方法的具体详情如下:
包路径:okhttp3.Dns
类名称:Dns
方法名:lookup

Dns.lookup介绍

[英]Returns the IP addresses of hostname, in the order they will be attempted by OkHttp. If a connection to an address fails, OkHttp will retry the connection with the next address until either a connection is made, the set of IP addresses is exhausted, or a limit is exceeded.
[中]返回主机名的IP地址,按照OkHttp尝试的顺序。如果与某个地址的连接失败,OkHttp将重试与下一个地址的连接,直到建立连接、耗尽IP地址集或超出限制。

代码示例

代码示例来源:origin: square/okhttp

List<InetAddress> addresses = address.dns().lookup(socketHost);
if (addresses.isEmpty()) {
 throw new UnknownHostException(address.dns() + " returned no addresses for " + socketHost);

代码示例来源:origin: com.squareup.okhttp3/okhttp

List<InetAddress> addresses = address.dns().lookup(socketHost);
if (addresses.isEmpty()) {
 throw new UnknownHostException(address.dns() + " returned no addresses for " + socketHost);

代码示例来源:origin: testcontainers/testcontainers-java

return Collections.singletonList(InetAddress.getByAddress(hostname, new byte[]{0, 0, 0, 0}));
} else {
  return Dns.SYSTEM.lookup(hostname);

代码示例来源:origin: qiniu/android-sdk

@Override
  public List<InetAddress> lookup(String hostname) throws UnknownHostException {
    try {
      return dns.lookup(hostname);
    } catch (Exception e) {
      e.printStackTrace();
    }
    return okhttp3.Dns.SYSTEM.lookup(hostname);
  }
});

代码示例来源:origin: qiniu/java-sdk

@Override
  public List<InetAddress> lookup(String hostname) throws UnknownHostException {
    try {
      return dns.lookup(hostname);
    } catch (Exception e) {
      e.printStackTrace();
    }
    return okhttp3.Dns.SYSTEM.lookup(hostname);
  }
});

代码示例来源:origin: com.qiniu/qiniu-java-sdk

@Override
  public List<InetAddress> lookup(String hostname) throws UnknownHostException {
    try {
      return dns.lookup(hostname);
    } catch (Exception e) {
      e.printStackTrace();
    }
    return okhttp3.Dns.SYSTEM.lookup(hostname);
  }
});

代码示例来源:origin: com.qiniu/qiniu-android-sdk

@Override
  public List<InetAddress> lookup(String hostname) throws UnknownHostException {
    try {
      return dns.lookup(hostname);
    } catch (Exception e) {
      e.printStackTrace();
    }
    return okhttp3.Dns.SYSTEM.lookup(hostname);
  }
});

代码示例来源:origin: org.leapframework/leap-webunit

@Override
public List<InetAddress> lookup(String hostname) throws UnknownHostException {
  InetAddress[] addresses = dnsMap.get(hostname);
  if(null != addresses) {
    return New.arrayList(addresses);
  }else{
    return Dns.SYSTEM.lookup(hostname);
  }
}

代码示例来源:origin: duzechao/OKHttpUtils

} else {
 List<InetAddress> addresses = address.dns().lookup(socketHost);
 for (int i = 0, size = addresses.size(); i < size; i++) {
  InetAddress inetAddress = addresses.get(i);

代码示例来源:origin: huxq17/tractor

} else {
 List<InetAddress> addresses = address.dns().lookup(socketHost);
 for (int i = 0, size = addresses.size(); i < size; i++) {
  InetAddress inetAddress = addresses.get(i);

代码示例来源:origin: huxq17/SwipeCardsView

} else {
 List<InetAddress> addresses = address.dns().lookup(socketHost);
 for (int i = 0, size = addresses.size(); i < size; i++) {
  InetAddress inetAddress = addresses.get(i);

代码示例来源:origin: com.github.ljun20160606/okhttp

List<InetAddress> addresses = address.dns().lookup(socketHost);
if (addresses.isEmpty()) {
 throw new UnknownHostException(address.dns() + " returned no addresses for " + socketHost);

代码示例来源:origin: apache/servicemix-bundles

List<InetAddress> addresses = address.dns().lookup(socketHost);
if (addresses.isEmpty()) {
 throw new UnknownHostException(address.dns() + " returned no addresses for " + socketHost);

相关文章