public InetSocketAddress toSocketAddress() { return new InetSocketAddress(getHost(), getPort()); }
@Override public synchronized String toString() { return String.format("HttpDestination@%x//%s:%d(%d/%d,%d,%d/%d)%n", hashCode(), _address.getHost(), _address.getPort(), _connections.size(), _maxConnections, _idleConnections.size(), _exchanges.size(), _maxQueueSize); }
@Override public String getProxyHost() { return getProxy().getHost(); }
public HttpDestination getDestination(Address remote, boolean ssl, SslContextFactory sslContextFactory) throws IOException { if (remote == null) throw new UnknownHostException("Remote socket address cannot be null."); HttpDestination destination = _destinations.get(remote); if (destination == null) { destination = new HttpDestination(this, remote, ssl, sslContextFactory); if (_proxy != null && (_noProxy == null || !_noProxy.contains(remote.getHost()))) { destination.setProxy(_proxy); if (_proxyAuthentication != null) destination.setProxyAuthentication(_proxyAuthentication); } HttpDestination other =_destinations.putIfAbsent(remote, destination); if (other!=null) destination=other; } return destination; }
HttpDestination(HttpClient client, Address address, boolean ssl, SslContextFactory sslContextFactory) { _client = client; _address = address; _ssl = ssl; _sslContextFactory = sslContextFactory; _maxConnections = _client.getMaxConnectionsPerAddress(); _maxQueueSize = _client.getMaxQueueSizePerAddress(); String addressString = address.getHost(); if (address.getPort() != (_ssl ? 443 : 80)) addressString += ":" + address.getPort(); _hostHeader = new ByteArrayBuffer(addressString); }
int port = address.getPort(); StringBuilder hostHeader = new StringBuilder( 64 ); hostHeader.append( address.getHost() ); if( !( ( port == 80 && !isHttps ) || ( port == 443 && isHttps ) ) )
String host = _destination.getAddress().getHost(); int port = _destination.getAddress().getPort(); StringBuilder absoluteURI = new StringBuilder();