public HttpDestination(HttpClient client, Origin origin) { this.client = client; this.origin = origin; this.exchanges = newExchangeQueue(client); this.requestNotifier = new RequestNotifier(client); this.responseNotifier = new ResponseNotifier(); ProxyConfiguration proxyConfig = client.getProxyConfiguration(); proxy = proxyConfig.match(origin); ClientConnectionFactory connectionFactory = client.getTransport(); if (proxy != null) { connectionFactory = proxy.newClientConnectionFactory(connectionFactory); } else { if (HttpScheme.HTTPS.is(getScheme())) connectionFactory = newSslClientConnectionFactory(connectionFactory); } this.connectionFactory = connectionFactory; String host = getHost(); if (!client.isDefaultPort(getScheme(), getPort())) host += ":" + getPort(); hostField = new HttpField(HttpHeader.HOST, host); }
public Origin.Address getConnectAddress() { return proxy == null ? origin.getAddress() : proxy.getAddress(); }