本文整理汇总了Java中com.qiniu.android.dns.local.AndroidDnsServer类的典型用法代码示例。如果您正苦于以下问题:Java AndroidDnsServer类的具体用法?Java AndroidDnsServer怎么用?Java AndroidDnsServer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AndroidDnsServer类属于com.qiniu.android.dns.local包,在下文中一共展示了AndroidDnsServer类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: testCnc
import com.qiniu.android.dns.local.AndroidDnsServer; //导入依赖的package包/类
public void testCnc() throws IOException {
IResolver[] resolvers = new IResolver[2];
resolvers[0] = AndroidDnsServer.defaultResolver();
resolvers[1] = new Resolver(InetAddress.getByName("223.5.5.5"));
DnsManager dns = new DnsManager(new NetworkInfo(NetworkInfo.NetSatus.MOBILE, NetworkInfo.ISP_CNC), resolvers);
dns.putHosts("hello.qiniu.com", "1.1.1.1");
dns.putHosts("hello.qiniu.com", "2.2.2.2");
dns.putHosts("qiniu.com", "3.3.3.3");
dns.putHosts("qiniu.com", "4.4.4.4", NetworkInfo.ISP_CNC);
Domain d = new Domain("qiniu.com", false, true);
String[] r = dns.query(d);
Assert.assertEquals(1, r.length);
Assert.assertEquals("4.4.4.4", r[0]);
}
开发者ID:qiniu,项目名称:happy-dns-android,代码行数:17,代码来源:DnsTest.java
示例2: testTtl
import com.qiniu.android.dns.local.AndroidDnsServer; //导入依赖的package包/类
public void testTtl() throws IOException {
IResolver[] resolvers = new IResolver[2];
resolvers[0] = AndroidDnsServer.defaultResolver();
resolvers[1] = new HijackingDetectWrapper(
new Resolver(InetAddress.getByName("223.5.5.5")));
DnsManager dns = new DnsManager(new NetworkInfo(
NetworkInfo.NetSatus.MOBILE, NetworkInfo.ISP_CNC), resolvers);
dns.putHosts("hello.qiniu.com", "1.1.1.1");
dns.putHosts("hello.qiniu.com", "2.2.2.2");
dns.putHosts("qiniu.com", "3.3.3.3");
dns.putHosts("qiniu.com", "4.4.4.4", NetworkInfo.ISP_CNC);
Domain d = new Domain("qiniu.com", false, false, 10);
String[] r = dns.query(d);
Assert.assertEquals(1, r.length);
Assert.assertEquals("4.4.4.4", r[0]);
d = new Domain("qiniu.com", false, false, 1000);
r = dns.query(d);
Assert.assertEquals(1, r.length);
Assert.assertTrue(!"4.4.4.4".equals(r[0]));
}
开发者ID:qiniu,项目名称:happy-dns-android,代码行数:24,代码来源:DnsTest.java
示例3: testCname
import com.qiniu.android.dns.local.AndroidDnsServer; //导入依赖的package包/类
public void testCname() throws IOException {
IResolver[] resolvers = new IResolver[2];
resolvers[0] = AndroidDnsServer.defaultResolver();
resolvers[1] = new HijackingDetectWrapper(
new Resolver(InetAddress.getByName("114.114.115.115")));
DnsManager dns = new DnsManager(NetworkInfo.normal, resolvers);
dns.putHosts("hello.qiniu.com", "1.1.1.1");
dns.putHosts("hello.qiniu.com", "2.2.2.2");
dns.putHosts("qiniu.com", "3.3.3.3");
dns.putHosts("qiniu.com", "4.4.4.4", NetworkInfo.ISP_CNC);
Domain d = new Domain("qiniu.com", true);
String[] r = dns.query(d);
Assert.assertEquals(1, r.length);
Assert.assertEquals("3.3.3.3", r[0]);
d = new Domain("qiniu.com", false);
r = dns.query(d);
Assert.assertEquals(1, r.length);
Assert.assertTrue(!"3.3.3.3".equals(r[0]));
}
开发者ID:qiniu,项目名称:happy-dns-android,代码行数:23,代码来源:DnsTest.java
示例4: testDns
import com.qiniu.android.dns.local.AndroidDnsServer; //导入依赖的package包/类
public void testDns() throws IOException {
IResolver[] resolvers = new IResolver[2];
resolvers[0] = AndroidDnsServer.defaultResolver();
resolvers[1] = new Resolver(InetAddress.getByName("223.5.5.5"));
DnsManager dns = new DnsManager(NetworkInfo.normal, resolvers);
String[] ips = dns.query("www.qiniu.com");
assertNotNull(ips);
assertTrue(ips.length > 0);
}
开发者ID:qiniu,项目名称:happy-dns-android,代码行数:10,代码来源:DnsTest.java
示例5: testIp
import com.qiniu.android.dns.local.AndroidDnsServer; //导入依赖的package包/类
public void testIp() throws IOException {
IResolver[] resolvers = new IResolver[1];
resolvers[0] = AndroidDnsServer.defaultResolver();
DnsManager dns = new DnsManager(NetworkInfo.normal, resolvers);
String[] ips = dns.query("1.1.1.1");
assertEquals(ips.length, 1);
assertEquals(ips[0], "1.1.1.1");
}
开发者ID:qiniu,项目名称:happy-dns-android,代码行数:9,代码来源:DnsTest.java
示例6: testCmd
import com.qiniu.android.dns.local.AndroidDnsServer; //导入依赖的package包/类
public void testCmd() {
long t1 = System.currentTimeMillis();
InetAddress[] servers = AndroidDnsServer.getByCommand();
long t2 = System.currentTimeMillis();
System.out.println(t2 - t1);
Assert.assertNotNull(servers);
Assert.assertTrue(servers.length > 0);
Log.v("localtest", servers[0].getHostAddress());
}
开发者ID:qiniu,项目名称:happy-dns-android,代码行数:10,代码来源:LocalServerTest.java
示例7: testReflection
import com.qiniu.android.dns.local.AndroidDnsServer; //导入依赖的package包/类
public void testReflection() {
long t1 = System.currentTimeMillis();
InetAddress[] servers = AndroidDnsServer.getByReflection();
long t2 = System.currentTimeMillis();
System.out.println(t2 - t1);
Assert.assertNotNull(servers);
Assert.assertTrue(servers.length > 0);
Log.v("localtest", servers[0].getHostAddress());
}
开发者ID:qiniu,项目名称:happy-dns-android,代码行数:10,代码来源:LocalServerTest.java
示例8: testLocal
import com.qiniu.android.dns.local.AndroidDnsServer; //导入依赖的package包/类
public void testLocal() {
template(AndroidDnsServer.defaultResolver());
}
开发者ID:qiniu,项目名称:happy-dns-android,代码行数:4,代码来源:LocalResolverTest.java
注:本文中的com.qiniu.android.dns.local.AndroidDnsServer类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论