Example usage for org.apache.commons.httpclient HttpConnection getLocalAddress

List of usage examples for org.apache.commons.httpclient HttpConnection getLocalAddress

Introduction

In this page you can find the example usage for org.apache.commons.httpclient HttpConnection getLocalAddress.

Prototype

public InetAddress getLocalAddress() 

Source Link

Document

Return the local address used when creating the connection.

Usage

From source file:com.exalead.io.failover.MonitoredHttpConnectionManager.java

/**
 * Gets the host configuration for a connection.
 * @param conn the connection to get the configuration of
 * @return a new HostConfiguration//  w  w w.  j ava  2  s .  c om
 */
static HostConfiguration rebuildConfigurationFromConnection(HttpConnection conn) {
    HostConfiguration connectionConfiguration = new HostConfiguration();
    connectionConfiguration.setHost(conn.getHost(), conn.getPort(), conn.getProtocol());
    if (conn.getLocalAddress() != null) {
        connectionConfiguration.setLocalAddress(conn.getLocalAddress());
    }
    if (conn.getProxyHost() != null) {
        connectionConfiguration.setProxy(conn.getProxyHost(), conn.getProxyPort());
    }
    return connectionConfiguration;
}