use of io.netty.handler.codec.http2.DefaultHttp2FrameWriter in project grpc-java by grpc.
the class NettyHandlerTestBase method rstStreamFrame.
protected final ByteBuf rstStreamFrame(int streamId, int errorCode) {
ChannelHandlerContext ctx = newMockContext();
new DefaultHttp2FrameWriter().writeRstStream(ctx, streamId, errorCode, newPromise());
return captureWrite(ctx);
}
use of io.netty.handler.codec.http2.DefaultHttp2FrameWriter in project grpc-java by grpc.
the class NettyHandlerTestBase method initChannel.
/**
* Must be called by subclasses to initialize the handler and channel.
*/
protected final void initChannel(GrpcHttp2HeadersDecoder headersDecoder) throws Exception {
content = Unpooled.copiedBuffer("hello world", UTF_8);
frameWriter = spy(new DefaultHttp2FrameWriter());
frameReader = new DefaultHttp2FrameReader(headersDecoder);
handler = newHandler();
channel = new EmbeddedChannel(handler);
ctx = channel.pipeline().context(handler);
writeQueue = initWriteQueue();
}
use of io.netty.handler.codec.http2.DefaultHttp2FrameWriter in project grpc-java by grpc.
the class NettyHandlerTestBase method headersFrame.
protected final ByteBuf headersFrame(int streamId, Http2Headers headers) {
ChannelHandlerContext ctx = newMockContext();
new DefaultHttp2FrameWriter().writeHeaders(ctx, streamId, headers, 0, false, newPromise());
return captureWrite(ctx);
}
use of io.netty.handler.codec.http2.DefaultHttp2FrameWriter in project grpc-java by grpc.
the class NettyClientHandler method newHandler.
static NettyClientHandler newHandler(ClientTransportLifecycleManager lifecycleManager, @Nullable KeepAliveManager keepAliveManager, int flowControlWindow, int maxHeaderListSize, Ticker ticker) {
Preconditions.checkArgument(maxHeaderListSize > 0, "maxHeaderListSize must be positive");
Http2HeadersDecoder headersDecoder = new GrpcHttp2ClientHeadersDecoder(maxHeaderListSize);
Http2FrameReader frameReader = new DefaultHttp2FrameReader(headersDecoder);
Http2FrameWriter frameWriter = new DefaultHttp2FrameWriter();
Http2Connection connection = new DefaultHttp2Connection(false);
return newHandler(connection, frameReader, frameWriter, lifecycleManager, keepAliveManager, flowControlWindow, maxHeaderListSize, ticker);
}
use of io.netty.handler.codec.http2.DefaultHttp2FrameWriter in project grpc-java by grpc.
the class NettyHandlerTestBase method serializeSettings.
protected final ByteBuf serializeSettings(Http2Settings settings) {
ChannelHandlerContext ctx = newMockContext();
new DefaultHttp2FrameWriter().writeSettings(ctx, settings, newPromise());
return captureWrite(ctx);
}
Aggregations