Examples of DnsResolver


Examples of org.apache.http.conn.DnsResolver

        Registry<ConnectionSocketFactory> socketFactoryRegistry = RegistryBuilder.<ConnectionSocketFactory>create()
                .register("http", PlainConnectionSocketFactory.INSTANCE)
                .register("https", new SSLConnectionSocketFactory(fetcher.sslContext(), new AllowAllHostnameVerifier()))
                .build();

        DnsResolver dnsResolver = new ServerCacheResolver(fetcher.getServerCache());

        ManagedHttpClientConnectionFactory connFactory = new ManagedHttpClientConnectionFactory(){
            private static final int DEFAULT_BUFSIZE = 8 * 1024;

            @Override
View Full Code Here

Examples of org.apache.http.conn.DnsResolver

            .register("http", PlainConnectionSocketFactory.INSTANCE)
            .register("https", new SSLConnectionSocketFactory(sslcontext))
            .build();

        // Use custom DNS resolver to override the system DNS resolution.
        DnsResolver dnsResolver = new SystemDefaultDnsResolver() {

            @Override
            public InetAddress[] resolve(final String host) throws UnknownHostException {
                if (host.equalsIgnoreCase("myhost")) {
                    return new InetAddress[] { InetAddress.getByAddress(new byte[] {127, 0, 0, 1}) };
View Full Code Here

Examples of org.apache.http.conn.DnsResolver

@Deprecated
public class TestDefaultClientConnectOperator {

    @Test
    public void testCustomDnsResolver() throws Exception {
        final DnsResolver dnsResolver = mock(DnsResolver.class);
        final InetAddress[] firstAddress = translateIp("192.168.1.1");
        when(dnsResolver.resolve("somehost.example.com")).thenReturn(firstAddress);

        final InetAddress[] secondAddress = translateIp("192.168.12.16");
        when(dnsResolver.resolve("otherhost.example.com")).thenReturn(secondAddress);

        final DefaultClientConnectionOperator operator = new DefaultClientConnectionOperator(
                SchemeRegistryFactory.createDefault(), dnsResolver);

        Assert.assertArrayEquals(firstAddress, operator.resolveHostname("somehost.example.com"));
View Full Code Here

Examples of org.apache.http.conn.DnsResolver

        Assert.assertArrayEquals(secondAddress, operator.resolveHostname("otherhost.example.com"));
    }

    @Test(expected=UnknownHostException.class)
    public void testDnsResolverUnknownHost() throws Exception {
        final DnsResolver dnsResolver = mock(DnsResolver.class);
        when(dnsResolver.resolve("unknown.example.com")).thenThrow(new UnknownHostException());

        final DefaultClientConnectionOperator operator = new DefaultClientConnectionOperator(
                SchemeRegistryFactory.createDefault(), dnsResolver);
        operator.resolveHostname("unknown.example.com");
    }
View Full Code Here

Examples of org.apache.whirr.net.DnsResolver

    clusterSpec = ClusterSpec.withTemporaryKeys();
    cluster = newCluster(1);
  }
 
  private Cluster newCluster(int numberOfWorkers) {
    DnsResolver fakeDnsResolver = new FakeDnsResolver();

    NodeMetadata node = mock(NodeMetadata.class);
    List<Processor> processors = ImmutableList.of(new Processor(4, 1.0));
    Hardware hardware = new HardwareImpl(null, null, "id", null, null,
        ImmutableMap.<String,String>of(), ImmutableSet.<String>of(), processors,
View Full Code Here

Examples of org.apache.whirr.net.DnsResolver

    clusterSpec = ClusterSpec.withTemporaryKeys();
    cluster = newCluster(1);
  }
 
  private Cluster newCluster(int numberOfWorkers) {
    DnsResolver fakeDnsResolver = new FakeDnsResolver();

    NodeMetadata node = mock(NodeMetadata.class);
    List<Processor> processors = ImmutableList.of(new Processor(4, 1.0));
    Hardware hardware = new HardwareImpl(null, null, "id", null, null,
        ImmutableMap.<String,String>of(), ImmutableSet.<String>of(), processors,
View Full Code Here

Examples of org.jasen.interfaces.DNSResolver

        String lookup = null;
        String strResult = null;
 
        Attributes result = null;
        Attribute attr = null;
        DNSResolver resolver = engine.getDnsResolver();
 
        for (int i = 0; i < rblRelays.size(); i++) {
          rbl = (String)rblRelays.get(i);
 
          lookup = senderIPAddress + "." + rbl;
 
          try {
            // Lookup
            logger.debug("Looking up " + lookup);
            result = resolver.lookup(lookup, "A");
 
            if(result != null) {
              // Get the returned address
                attr = result.get("A");
               
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.