// Path: src/main/java/cz/tomasdvorak/eet/client/dto/DnsResolver.java
// public interface DnsResolver {
// 
//     /**
//      * Convert a domain name to IP address.
//      *
//      * @param hostname Pure hostname, without protocol or path. For example pg.eet.cz
//      * @return IP address as a String
//      * @throws UnknownHostException in case DNS lookup fails.
//      */
//     String getHostAddress(String hostname) throws UnknownHostException;
// }


import cz.tomasdvorak.eet.client.config.EndpointType;
import cz.tomasdvorak.eet.client.dto.DnsResolver;
import cz.tomasdvorak.eet.client.exceptions.DnsLookupFailedException;
import cz.tomasdvorak.eet.client.exceptions.DnsTimeoutException;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import java.net.MalformedURLException;
import java.net.UnknownHostException;
import java.util.concurrent.TimeoutException;
                    }
                } else {
                    throw new UnknownHostException(host);
                }
            }
        };
        this.resolver = new DnsLookupWithTimeout(resolverImpl, 100);
    }

    @Test(timeout = 10000)
    public void resolveOk() throws Exception {
        final String resolved = resolver.resolveAddress(EndpointType.PLAYGROUND.getWebserviceUrl());
        Assert.assertEquals("5.145.105.129", resolved);
    }

    @Test(timeout = 10000)
    public void testResolveTimeout() {
        try {
            resolver.resolveAddress("http://nonsense-timeouting.tomas-dvorak.cz/ws/");
            Assert.fail("Should throw an exception");
        } catch (DnsLookupFailedException e) {
            Assert.fail("Should throw an timeout exception");
        } catch (DnsTimeoutException e) {
            final Throwable cause = e.getCause();
            Assert.assertEquals(TimeoutException.class, cause.getClass());
            Assert.assertEquals("DNS Lookup for host nonsense-timeouting.tomas-dvorak.cz timed out", e.getMessage());
        }
    }

    @Test(timeout = 10000)
// Path: src/main/java/cz/tomasdvorak/eet/client/dto/DnsResolver.java
// public interface DnsResolver {
// 
//     /**
//      * Convert a domain name to IP address.
//      *
//      * @param hostname Pure hostname, without protocol or path. For example pg.eet.cz
//      * @return IP address as a String
//      * @throws UnknownHostException in case DNS lookup fails.
//      */
//     String getHostAddress(String hostname) throws UnknownHostException;
// }


// Path: src/test/java/cz/tomasdvorak/eet/client/networking/DnsLookupWithTimeoutTest.java
import cz.tomasdvorak.eet.client.config.EndpointType;
import cz.tomasdvorak.eet.client.dto.DnsResolver;
import cz.tomasdvorak.eet.client.exceptions.DnsLookupFailedException;
import cz.tomasdvorak.eet.client.exceptions.DnsTimeoutException;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import java.net.MalformedURLException;
import java.net.UnknownHostException;
import java.util.concurrent.TimeoutException;

                    }
                } else {
                    throw new UnknownHostException(host);
                }
            }
        };
        this.resolver = new DnsLookupWithTimeout(resolverImpl, 100);
    }

    @Test(timeout = 10000)
    public void resolveOk() throws Exception {
        final String resolved = resolver.resolveAddress(EndpointType.PLAYGROUND.getWebserviceUrl());
        Assert.assertEquals("5.145.105.129", resolved);
    }

    @Test(timeout = 10000)
    public void testResolveTimeout() {
        try {
            resolver.resolveAddress("http://nonsense-timeouting.tomas-dvorak.cz/ws/");
            Assert.fail("Should throw an exception");
        } catch (DnsLookupFailedException e) {
            Assert.fail("Should throw an timeout exception");
        } catch (DnsTimeoutException e) {
            final Throwable cause = e.getCause();
            Assert.assertEquals(TimeoutException.class, cause.getClass());
            Assert.assertEquals("DNS Lookup for host nonsense-timeouting.tomas-dvorak.cz timed out", e.getMessage());
        }
    }

    @Test(timeout = 10000)
    public void testResolveUnknownHost() {