Package org.mockserver.netty.unification
Class Http2GoAwayEmitter
java.lang.Object
org.mockserver.netty.unification.Http2GoAwayEmitter
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.resetHttp2Stream — ctx.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 TypeMethodDescriptionstatic booleanemit(io.netty.channel.ChannelHandlerContext ctx, long lastStreamId, long errorCode) Emit a GOAWAY on the connection carryingctx, if it is a connection-level HTTP/2 pipeline.
-
Method Details
-
emit
public static boolean emit(io.netty.channel.ChannelHandlerContext ctx, long lastStreamId, long errorCode) Emit a GOAWAY on the connection carryingctx, if it is a connection-level HTTP/2 pipeline.- Parameters:
ctx- a context on the HTTP/2 channel's pipelinelastStreamId- thelastStreamIdto 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:
trueif a GOAWAY was written (connection-level HTTP/2 pipeline present),falseotherwise (e.g. HTTP/1.1, or no HTTP/2 connection handler on the pipeline)
-