Class ResilientTransport

java.lang.Object
io.bytestreams.exchange.core.ResilientTransport
All Implemented Interfaces:
Transport, Closeable, AutoCloseable

public final class ResilientTransport extends Object implements Transport
A Transport decorator that automatically reconnects using a TransportFactory when the underlying transport fails.

Reconnection happens at message boundaries — when inputStream() or outputStream() is called after a failure has been detected. The returned streams are wrapped to detect I/O failures and set an internal stale flag, which triggers reconnection on the next stream access.

Stream identity: Unlike the general Transport contract, this implementation may return different stream instances after a reconnect. This is safe with AbstractChannel, which re-fetches streams on each loop iteration.

Use builder(TransportFactory) to configure backoff strategy and max attempts.