Class Http2GoAwayEmitter

java.lang.Object
org.mockserver.netty.unification.Http2GoAwayEmitter

public final class Http2GoAwayEmitter extends Object
Emits an HTTP/2 GOAWAY frame on a connection-level (default) HTTP/2 pipeline so the client is told to stop opening new streams and drain — the graceful "this connection is going away" signal a server sends before a shutdown / preemption. In-flight streams are allowed to complete; GOAWAY does not reset them.

The connection handler is resolved with the same lookup pattern as HttpErrorActionHandler.resetHttp2Streamctx.pipeline().context(Http2ConnectionHandler.class) — so this works whether called from a child handler or the connection handler's own context.

v1 supports the connection-level pipeline only. The multiplex pipeline (per-stream child channels, used for gRPC bidi streaming) is intentionally deferred — see docs/code/chaos.md. HTTP/1.1 has no GOAWAY concept; callers degrade to Connection: close + 503 instead.

  • Method Summary

    Modifier and Type
    Method
    Description
    static boolean
    emit(io.netty.channel.ChannelHandlerContext ctx, long lastStreamId, long errorCode)
    Emit a GOAWAY on the connection carrying ctx, if it is a connection-level HTTP/2 pipeline.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • emit

      public static boolean emit(io.netty.channel.ChannelHandlerContext ctx, long lastStreamId, long errorCode)
      Emit a GOAWAY on the connection carrying ctx, if it is a connection-level HTTP/2 pipeline.
      Parameters:
      ctx - a context on the HTTP/2 channel's pipeline
      lastStreamId - the lastStreamId to advertise; when negative the connection handler's current last-stream-id is used (passing the max stream id so the handler clamps to the connection's actual last-processed stream)
      errorCode - the HTTP/2 error code (0 = NO_ERROR, the graceful-shutdown code)
      Returns:
      true if a GOAWAY was written (connection-level HTTP/2 pipeline present), false otherwise (e.g. HTTP/1.1, or no HTTP/2 connection handler on the pipeline)