Search in sources :

Example 46 with HostAndPort

use of com.google.common.net.HostAndPort in project tesla by linking12.

the class ProxyToServerConnection method addressFor.

public static InetSocketAddress addressFor(String hostAndPort, HttpProxyServer proxyServer) throws UnknownHostException {
    HostAndPort parsedHostAndPort;
    try {
        parsedHostAndPort = HostAndPort.fromString(hostAndPort);
    } catch (IllegalArgumentException e) {
        throw new UnknownHostException(hostAndPort);
    }
    String host = parsedHostAndPort.getHost();
    int port = parsedHostAndPort.getPortOrDefault(80);
    return proxyServer.getServerResolver().resolve(host, port);
}
Also used : HostAndPort(com.google.common.net.HostAndPort) UnknownHostException(java.net.UnknownHostException)

Aggregations

HostAndPort (com.google.common.net.HostAndPort)46 IOException (java.io.IOException)8 Test (org.junit.Test)7 InetSocketAddress (java.net.InetSocketAddress)5 InputStream (java.io.InputStream)4 ArrayList (java.util.ArrayList)4 Request (com.metamx.http.client.Request)3 SequenceInputStreamResponseHandler (com.metamx.http.client.response.SequenceInputStreamResponseHandler)3 SystemException (com.torodb.core.exceptions.SystemException)3 JCommander (com.beust.jcommander.JCommander)2 Console (com.beust.jcommander.internal.Console)2 OpTime (com.eightkdata.mongowp.OpTime)2 UnreachableMongoServerException (com.eightkdata.mongowp.client.core.UnreachableMongoServerException)2 MongoException (com.eightkdata.mongowp.exceptions.MongoException)2 Charsets (com.google.common.base.Charsets)2 Throwables (com.google.common.base.Throwables)2 Service (com.google.common.util.concurrent.Service)2 CreationException (com.google.inject.CreationException)2 NoSyncSourceFoundException (com.torodb.mongodb.repl.exceptions.NoSyncSourceFoundException)2 BackendPasswordConfig (com.torodb.packaging.config.model.backend.BackendPasswordConfig)2