Class PausedStreamFrame

java.lang.Object
org.mockserver.mock.breakpoint.PausedStreamFrame

public class PausedStreamFrame extends Object
Represents a single streaming frame that has been paused at a breakpoint, awaiting external resolution via the control-plane REST API or an automatic timeout.

The held frame's bytes are captured as a byte[] copy at park time — the original Netty ByteBuf is NOT retained here. Instead, the caller retains the ByteBuf, and the decision callback tells the caller what to do with it (write, replace, drop, etc.). This avoids the complexity of holding a refcounted ByteBuf across threads and timeouts.

Thread-safety: the decisionFuture is a CompletableFuture which is thread-safe. Fields are immutable after construction.

  • Constructor Details

    • PausedStreamFrame

      public PausedStreamFrame(String frameId, String streamId, int sequenceNumber, byte[] capturedBytes, String requestMethod, String requestPath)
      Creates a paused frame with the default OUTBOUND direction (backward compatible).
    • PausedStreamFrame

      public PausedStreamFrame(String frameId, String streamId, int sequenceNumber, byte[] capturedBytes, String requestMethod, String requestPath, PausedStreamFrame.Direction direction)
      Creates a paused frame with an explicit direction.
    • PausedStreamFrame

      public PausedStreamFrame(String frameId, String streamId, int sequenceNumber, byte[] capturedBytes, String requestMethod, String requestPath, PausedStreamFrame.Direction direction, Long requestTimestamp)
      Creates a paused frame with an explicit direction and request timestamp.
  • Method Details

    • getFrameId

      public String getFrameId()
      Unique id for this frame within the stream breakpoint registry.
    • getStreamId

      public String getStreamId()
      The stream id (correlation id) this frame belongs to. Multiple frames from the same forwarded response share the same stream id.
    • getSequenceNumber

      public int getSequenceNumber()
      0-based sequence number within the stream. Frames MUST be resumed in order.
    • getCapturedBytes

      public byte[] getCapturedBytes()
      A copy of the frame's payload bytes at the time it was parked.
    • getDecisionFuture

      public CompletableFuture<StreamFrameDecision> getDecisionFuture()
      The future that the relay loop awaits. Completing this future resumes frame processing.
    • getCreatedAtMillis

      public long getCreatedAtMillis()
    • ageMillis

      public long ageMillis()
      Age in milliseconds since this frame was paused.
    • getRequestMethod

      public String getRequestMethod()
      The request method of the original forwarded request (for context/logging).
    • getRequestPath

      public String getRequestPath()
      The request path of the original forwarded request (for context/logging).
    • getDirection

      public PausedStreamFrame.Direction getDirection()
      The direction of this frame: OUTBOUND (server-to-client) or INBOUND (client-to-server).
    • getRequestTimestamp

      public Long getRequestTimestamp()
      The epoch-millis timestamp at which MockServer first received the originating request. May be null for backward compatibility.