Interface ChainedProxy

All Superinterfaces:
SslContextSource
All Known Implementing Classes:
ChainedProxyAdapter

public interface ChainedProxy extends SslContextSource
An upstream proxy that requests are forwarded through.
  • Method Details

    • getChainedProxyAddress

      InetSocketAddress getChainedProxyAddress()
      Returns the upstream proxy address.
      Returns:
      the upstream proxy address
    • getLocalAddress

      default InetSocketAddress getLocalAddress()
      Returns the local address to bind when connecting, or null for any.
      Returns:
      the local address to bind when connecting, or null for any
    • getChainedProxyType

      default ChainedProxyType getChainedProxyType()
      Returns the protocol spoken by the upstream proxy.
      Returns:
      the protocol spoken by the upstream proxy
    • getUsername

      default String getUsername()
      Returns user name for upstream authentication (HTTP Basic or SOCKS), or null.
      Returns:
      user name for upstream authentication (HTTP Basic or SOCKS), or null
    • getPassword

      default String getPassword()
      Returns the upstream authentication password, or null.
      Returns:
      the upstream authentication password, or null
    • requiresEncryption

      default boolean requiresEncryption()
      Returns whether the connection to the chained proxy itself uses TLS (see getSslContext()).
      Returns:
      whether the connection to the chained proxy itself uses TLS (see getSslContext())
    • http2

      default boolean http2()
      Whether to speak HTTP/2 to this proxy (an ChainedProxyType.HTTP one) rather than HTTP/1.1: its connections are then shared, each CONNECT tunnel and each plain-HTTP request a stream of one (RFC 9113 section 8.5), up to the proxy's SETTINGS_MAX_CONCURRENT_STREAMS, with another connection opened when they are full. Over TLS (requiresEncryption()) h2 is offered with ALPN, next to http/1.1, which the proxy may choose instead; over plain TCP the proxy must speak HTTP/2 with prior knowledge (h2c). The connections are shared by every client, and by every chained proxy with the same address, TLS, SSLContext instance, credentials and local address. Needs the http2-codec module on the class path, without which the proxy is reached over HTTP/1.1. The default is false.
      Returns:
      whether to speak HTTP/2 to this proxy
    • getSslContext

      default SSLContext getSslContext()
      Description copied from interface: SslContextSource
      Returns the TLS context for this connection.
      Specified by:
      getSslContext in interface SslContextSource
      Returns:
      the TLS context for this connection
    • filterRequest

      default void filterRequest(HttpObject httpObject)
      Last chance to modify each request object before it is sent to this proxy.
      Parameters:
      httpObject - the request head or body piece
    • connectionSucceeded

      default void connectionSucceeded()
      Called when the upstream proxy connection succeeds.
    • connectionFailed

      default void connectionFailed(Throwable cause)
      Called when connecting fails; the proxy then tries the next chained proxy, if any.
      Parameters:
      cause - the failure that triggered this event
    • disconnected

      default void disconnected()
      Called when the upstream proxy connection closes.