Class HttpProxy
Client-side proxy configuration for HTTP proxying, as specified by RFC 9110.
By default the communication between client and proxy happens using the HTTP/1.1 protocol, but it may be configured to use also other HTTP protocol versions, such as HTTP/2.
- 
Constructor Summary
ConstructorsConstructorDescriptionCreates a new instance with the given HTTP proxy host and port.HttpProxy(Origin.Address address, boolean secure) Creates a new instance with the given HTTP proxy address.HttpProxy(Origin.Address address, boolean secure, Origin.Protocol protocol) Creates a new instance with the given HTTP proxy address and protocol.HttpProxy(Origin.Address address, SslContextFactory.Client sslContextFactory) Creates a new instance with the given HTTP proxy address and TLS configuration.HttpProxy(Origin.Address address, SslContextFactory.Client sslContextFactory, Origin.Protocol protocol) Creates a new instance with the given HTTP proxy address, TLS configuration and protocol.HttpProxy(Origin origin, SslContextFactory.Client sslContextFactory) Creates a new instance with the given HTTP proxyOriginand TLS configuration. - 
Method Summary
Modifier and TypeMethodDescriptiongetURI()newClientConnectionFactory(ClientConnectionFactory connectionFactory) booleanrequiresTunnel(Origin serverOrigin) Methods inherited from class ProxyConfiguration.Proxy
getAddress, getExcludedAddresses, getIncludedAddresses, getOrigin, getProtocol, getSslContextFactory, isSecure, matches, toString 
- 
Constructor Details
- 
HttpProxy
Creates a new instance with the given HTTP proxy host and port.
- Parameters:
 host- the HTTP proxy host nameport- the HTTP proxy port
 - 
HttpProxy
Creates a new instance with the given HTTP proxy address.
When
secure=truethe communication between the client and the proxy will be encrypted (using this proxyProxyConfiguration.Proxy.getSslContextFactory()which typically defaults to that ofHttpClient.- Parameters:
 address- the HTTP proxy address (host and port)secure- whether the communication between the client and the HTTP proxy should be secure
 - 
HttpProxy
Creates a new instance with the given HTTP proxy address and protocol.
- Parameters:
 address- the HTTP proxy address (host and port)secure- whether the communication between the client and the HTTP proxy should be secureprotocol- the protocol to use to communicate with the HTTP proxy
 - 
HttpProxy
Creates a new instance with the given HTTP proxy address and TLS configuration.
The
SslContextFactorycould have a different configuration from the one configured inHttpClient, and it is used to communicate with the HTTP proxy only (not to communicate with the servers).- Parameters:
 address- the HTTP proxy address (host and port)sslContextFactory- theSslContextFactory.Clientto use to communicate with the HTTP proxy
 - 
HttpProxy
public HttpProxy(Origin.Address address, SslContextFactory.Client sslContextFactory, Origin.Protocol protocol) Creates a new instance with the given HTTP proxy address, TLS configuration and protocol.
The
SslContextFactorycould have a different configuration from the one configured inHttpClientand it is used to communicate with the HTTP proxy only (not to communicate with the servers).- Parameters:
 address- the HTTP proxy address (host and port)sslContextFactory- theSslContextFactory.Clientto use to communicate with the HTTP proxyprotocol- the protocol to use to communicate with the HTTP proxy
 - 
HttpProxy
Creates a new instance with the given HTTP proxy
Originand TLS configuration.The
SslContextFactorycould have a different configuration from the one configured inHttpClientand it is used to communicate with the HTTP proxy only (not to communicate with the servers).- Parameters:
 origin- the HTTP proxyOrigininformationsslContextFactory- theSslContextFactory.Clientto use to communicate with the HTTP proxy
 
 - 
 - 
Method Details
- 
newClientConnectionFactory
public ClientConnectionFactory newClientConnectionFactory(ClientConnectionFactory connectionFactory) - Specified by:
 newClientConnectionFactoryin classProxyConfiguration.Proxy- Parameters:
 connectionFactory- the nestedClientConnectionFactory- Returns:
 - a new 
ClientConnectionFactoryfor this Proxy 
 - 
getURI
- Overrides:
 getURIin classProxyConfiguration.Proxy- Returns:
 - an URI representing this proxy, or null if no URI can represent this proxy
 
 - 
requiresTunnel
 
 -