Class ChainedProxyConnectException

All Implemented Interfaces:
Serializable

public final class ChainedProxyConnectException extends ConnectException
A chained HTTP proxy did not open the tunnel the proxy's CONNECT asked it for: it answered with a status other than 2xx (ChainedProxyConnectException.Outcome.REFUSED, with status()), or ended the connection before it answered (ChainedProxyConnectException.Outcome.CLOSED, ChainedProxyConnectException.Outcome.RESET). It is the ProxyFailure.ConnectFailed.cause() of such an attempt (the last one's, with several routes), and what ChainedProxy.connectionFailed(java.lang.Throwable) gets; ProxyFailure.ConnectFailed.reason() and ProxyFailure.ConnectFailed.chainedProxyStatus() read it.

Its message is the one such a failure always had: "chained proxy refused CONNECT: 407 Proxy Authentication Required", "chained proxy refused CONNECT: connection closed", or, for a reset, the socket's own ("Connection reset"), whose exception is then the cause.

See Also:
  • Method Details

    • refused

      public static ChainedProxyConnectException refused(int status, String reasonPhrase)
      The chained proxy answered the CONNECT with status, not 2xx.
      Parameters:
      status - the status code
      reasonPhrase - the status line's reason phrase, as the proxy sent it
      Returns:
      the exception
    • closed

      public static ChainedProxyConnectException closed(IOException cause)
      The chained proxy closed the connection before its answer to the CONNECT was complete.
      Parameters:
      cause - what reading the answer failed with, or null when it just ended
      Returns:
      the exception
    • reset

      public static ChainedProxyConnectException reset(IOException cause)
      The connection to the chained proxy was reset (or failed otherwise) before its answer to the CONNECT was complete.
      Parameters:
      cause - the socket's exception, whose message this one keeps
      Returns:
      the exception
    • outcome

      Returns how the CONNECT failed.
      Returns:
      how the CONNECT failed
    • status

      public OptionalInt status()
      Returns the status the chained proxy answered the CONNECT with, empty when it answered none.
      Returns:
      the status the chained proxy answered the CONNECT with, empty when it answered none