Search in sources :

Example 6 with DefaultHttp2FrameWriter

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);
}
Also used : ChannelHandlerContext(io.netty.channel.ChannelHandlerContext) DefaultHttp2FrameWriter(io.netty.handler.codec.http2.DefaultHttp2FrameWriter)

Example 7 with DefaultHttp2FrameWriter

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();
}
Also used : EmbeddedChannel(io.netty.channel.embedded.EmbeddedChannel) DefaultHttp2FrameWriter(io.netty.handler.codec.http2.DefaultHttp2FrameWriter) DefaultHttp2FrameReader(io.netty.handler.codec.http2.DefaultHttp2FrameReader)

Example 8 with DefaultHttp2FrameWriter

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);
}
Also used : ChannelHandlerContext(io.netty.channel.ChannelHandlerContext) DefaultHttp2FrameWriter(io.netty.handler.codec.http2.DefaultHttp2FrameWriter)

Example 9 with DefaultHttp2FrameWriter

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);
}
Also used : DefaultHttp2Connection(io.netty.handler.codec.http2.DefaultHttp2Connection) DefaultHttp2FrameWriter(io.netty.handler.codec.http2.DefaultHttp2FrameWriter) Http2FrameWriter(io.netty.handler.codec.http2.Http2FrameWriter) Http2FrameReader(io.netty.handler.codec.http2.Http2FrameReader) DefaultHttp2FrameReader(io.netty.handler.codec.http2.DefaultHttp2FrameReader) DefaultHttp2Connection(io.netty.handler.codec.http2.DefaultHttp2Connection) Http2Connection(io.netty.handler.codec.http2.Http2Connection) GrpcHttp2ClientHeadersDecoder(io.grpc.netty.GrpcHttp2HeadersDecoder.GrpcHttp2ClientHeadersDecoder) Http2HeadersDecoder(io.netty.handler.codec.http2.Http2HeadersDecoder) DefaultHttp2FrameWriter(io.netty.handler.codec.http2.DefaultHttp2FrameWriter) DefaultHttp2FrameReader(io.netty.handler.codec.http2.DefaultHttp2FrameReader)

Example 10 with DefaultHttp2FrameWriter

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);
}
Also used : ChannelHandlerContext(io.netty.channel.ChannelHandlerContext) DefaultHttp2FrameWriter(io.netty.handler.codec.http2.DefaultHttp2FrameWriter)

Aggregations

DefaultHttp2FrameWriter (io.netty.handler.codec.http2.DefaultHttp2FrameWriter)13 ChannelHandlerContext (io.netty.channel.ChannelHandlerContext)9 DefaultHttp2FrameReader (io.netty.handler.codec.http2.DefaultHttp2FrameReader)6 ByteBuf (io.netty.buffer.ByteBuf)4 ChannelFuture (io.netty.channel.ChannelFuture)3 DefaultHttp2Connection (io.netty.handler.codec.http2.DefaultHttp2Connection)3 DefaultHttp2ConnectionDecoder (io.netty.handler.codec.http2.DefaultHttp2ConnectionDecoder)3 DefaultHttp2ConnectionEncoder (io.netty.handler.codec.http2.DefaultHttp2ConnectionEncoder)3 Http2Connection (io.netty.handler.codec.http2.Http2Connection)3 Http2ConnectionDecoder (io.netty.handler.codec.http2.Http2ConnectionDecoder)3 Http2ConnectionEncoder (io.netty.handler.codec.http2.Http2ConnectionEncoder)3 Bootstrap (io.netty.bootstrap.Bootstrap)2 ServerBootstrap (io.netty.bootstrap.ServerBootstrap)2 Channel (io.netty.channel.Channel)2 ChannelPipeline (io.netty.channel.ChannelPipeline)2 ChannelPromise (io.netty.channel.ChannelPromise)2 DefaultChannelPromise (io.netty.channel.DefaultChannelPromise)2 NioEventLoopGroup (io.netty.channel.nio.NioEventLoopGroup)2 NioServerSocketChannel (io.netty.channel.socket.nio.NioServerSocketChannel)2 NioSocketChannel (io.netty.channel.socket.nio.NioSocketChannel)2