Class TransportException

java.lang.Object
java.lang.Throwable
java.lang.Exception
java.io.IOException
org.apache.juneau.rest.client.TransportException
All Implemented Interfaces:
Serializable

public class TransportException extends IOException
Thrown by HttpTransport.execute(TransportRequest) when a network-level error occurs (e.g. connection refused, timeout, SSL handshake failure).

This exception wraps the underlying transport library's exception so that callers do not need to handle Apache HttpClient, OkHttp, or JDK HttpClient exceptions directly.

Since:
9.2.1
See Also:
  • Constructor Details

    • TransportException

      public TransportException(String message)
      Constructor.
      Parameters:
      message - The error message.
    • TransportException

      public TransportException(String message, Throwable cause)
      Constructor.
      Parameters:
      message - The error message.
      cause - The underlying cause. Can be null (no cause is chained).
    • TransportException

      Constructor.
      Parameters:
      cause - The underlying cause. Can be null (no cause is chained).
  • Method Details

    • isStaleConnectionFailure

      public static boolean isStaleConnectionFailure(Throwable t)
      Returns true if the given throwable (or any cause in its chain) is the signature of a pre-response stale pooled-connection failure — the server tore down a kept-alive connection before sending any response bytes.

      This is recognized across transports as an EOFException or ClosedChannelException, a connection-reset SocketException, or the JDK HttpClient's "HTTP/1.1 header parser received no bytes" message. Such a failure is safe to replay exactly once on a fresh connection provided the request cannot cause a duplicate side effect (an idempotent HTTP method, or — at a higher protocol layer — a side-effect-free operation).

      Parameters:
      t - The throwable to inspect. Can be null (returns false).
      Returns:
      true if the throwable indicates a pre-response stale-connection failure.