Class GrpcBidiRouterHandler

java.lang.Object
io.netty.channel.ChannelHandlerAdapter
io.netty.channel.ChannelInboundHandlerAdapter
org.mockserver.netty.grpc.GrpcBidiRouterHandler
All Implemented Interfaces:
io.netty.channel.ChannelHandler, io.netty.channel.ChannelInboundHandler

public class GrpcBidiRouterHandler extends io.netty.channel.ChannelInboundHandlerAdapter
Per-stream router that inspects the first Http2HeadersFrame to determine whether this stream is a true bidirectional-streaming gRPC method. NOT @Sharable -- per-stream stateful (consumes the first HEADERS frame, then replaces itself).

Routing logic (Phase 3b):

  • If the method is both isClientStreaming() and isServerStreaming() (true bidi) AND a matched expectation has a GrpcBidiResponse action: replaces itself with GrpcBidiStreamHandler configured from the matched expectation, sets autoRead off, and re-fires the HEADERS frame to the new handler.
  • Otherwise (unary, server-streaming, client-streaming, non-gRPC, or bidi without a matching GrpcBidiResponse expectation): installs the existing Phase 0 re-aggregating chain via GrpcMultiplexChildInitializer.installReAggregatingChain(io.netty.channel.ChannelPipeline, org.mockserver.configuration.Configuration, org.mockserver.logging.MockServerLogger, boolean, java.security.cert.Certificate[], io.netty.channel.Channel, org.mockserver.netty.websocketregistry.CallbackWebSocketServerHandler, org.mockserver.dashboard.DashboardWebSocketHandler, org.mockserver.netty.mcp.McpStreamableHttpHandler, org.mockserver.netty.unification.TraceContextHandler, org.mockserver.netty.unification.AltSvcHeaderHandler, org.mockserver.netty.grpc.GrpcToHttpResponseHandler, org.mockserver.netty.grpc.GrpcToHttpRequestHandler, org.mockserver.netty.HttpRequestHandler) and re-fires the HEADERS frame. Non-bidi streams are byte-for-byte unchanged.