okhttp3.Dns类的使用及代码示例

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

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

Dns介绍

[英]A domain name service that resolves IP addresses for host names. Most applications will use the #SYSTEM, which is the default. Some applications may provide their own implementation to use a different DNS server, to prefer IPv6 addresses, to prefer IPv4 addresses, or to force a specific known IP address.

Implementations of this interface must be safe for concurrent use.
[中]解析主机名IP地址的域名服务。大多数应用程序将使用默认的#系统。一些应用程序可以提供自己的实现来使用不同的DNS服务器、首选IPv6地址、首选IPv4地址或强制使用特定的已知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);

相关文章