@UnstableApi
    default StreamMessage<T> timeout(Duration timeoutDuration, StreamTimeoutMode timeoutMode) {
        requireNonNull(timeoutDuration, "timeoutDuration");
        requireNonNull(timeoutMode, "timeoutMode");
        return new TimeoutStreamMessage<>(this, timeoutDuration, timeoutMode);
    }
Configures a timeout for the stream based on the specified duration and mode. >If no events are received
within the specified duration, the stream will be terminated with a {@link StreamTimeoutException}.

<p>Example usage:
<pre>{@code
StreamMessage<String> stream = ...;
StreamMessage<String> timeoutStream = stream.timeout(
    Duration.ofSeconds(10),
    StreamTimeoutMode.UNTIL_FIRST
);
}</pre>

@param timeoutDuration the duration before a timeout occurs
@param timeoutMode the mode in which the timeout is applied (see {@link StreamTimeoutMode} for details)
@return a new {@link StreamMessage} with the specified timeout duration and mode applied
core/src/main/java/com/linecorp/armeria/common/stream/StreamMessage.java