• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java DefaultHttp2FrameWriter类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中io.netty.handler.codec.http2.DefaultHttp2FrameWriter的典型用法代码示例。如果您正苦于以下问题:Java DefaultHttp2FrameWriter类的具体用法?Java DefaultHttp2FrameWriter怎么用?Java DefaultHttp2FrameWriter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



DefaultHttp2FrameWriter类属于io.netty.handler.codec.http2包,在下文中一共展示了DefaultHttp2FrameWriter类的16个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: newHttp2ConnectionHandler

import io.netty.handler.codec.http2.DefaultHttp2FrameWriter; //导入依赖的package包/类
private Http2ClientConnectionHandler newHttp2ConnectionHandler(Channel ch) {
    final boolean validateHeaders = false;
    final Http2Connection conn = new DefaultHttp2Connection(false);
    conn.addListener(new Http2GoAwayListener(ch));

    Http2FrameReader reader = new DefaultHttp2FrameReader(validateHeaders);
    Http2FrameWriter writer = new DefaultHttp2FrameWriter();

    Http2ConnectionEncoder encoder = new DefaultHttp2ConnectionEncoder(conn, writer);
    Http2ConnectionDecoder decoder = new DefaultHttp2ConnectionDecoder(conn, encoder, reader);

    final Http2Settings http2Settings = http2Settings();

    final Http2ResponseDecoder listener = new Http2ResponseDecoder(conn, ch, encoder);
    final Http2ClientConnectionHandler handler =
            new Http2ClientConnectionHandler(decoder, encoder, http2Settings, listener);
    // Setup post build options
    handler.gracefulShutdownTimeoutMillis(clientFactory.idleTimeoutMillis());

    return handler;
}
 
开发者ID:line,项目名称:armeria,代码行数:22,代码来源:HttpClientPipelineConfigurator.java


示例2: newHttp2ConnectionHandler

import io.netty.handler.codec.http2.DefaultHttp2FrameWriter; //导入依赖的package包/类
private Http2ConnectionHandler newHttp2ConnectionHandler(ChannelPipeline pipeline) {

        final Http2Connection conn = new DefaultHttp2Connection(true);
        conn.addListener(new Http2GoAwayListener(pipeline.channel()));

        Http2FrameReader reader = new DefaultHttp2FrameReader(true);
        Http2FrameWriter writer = new DefaultHttp2FrameWriter();

        Http2ConnectionEncoder encoder = new DefaultHttp2ConnectionEncoder(conn, writer);
        Http2ConnectionDecoder decoder = new DefaultHttp2ConnectionDecoder(conn, encoder, reader);

        final Http2ConnectionHandler handler =
                new Http2ServerConnectionHandler(decoder, encoder, new Http2Settings());

        // Setup post build options
        final Http2RequestDecoder listener =
                new Http2RequestDecoder(config, pipeline.channel(), handler.encoder());

        handler.connection().addListener(listener);
        handler.decoder().frameListener(listener);
        handler.gracefulShutdownTimeoutMillis(config.idleTimeoutMillis());

        return handler;
    }
 
开发者ID:line,项目名称:armeria,代码行数:25,代码来源:HttpServerPipelineConfigurator.java


示例3: grpcDataFrame

import io.netty.handler.codec.http2.DefaultHttp2FrameWriter; //导入依赖的package包/类
protected ByteBuf grpcDataFrame(int streamId, boolean endStream, byte[] content) {
  final ByteBuf compressionFrame = Unpooled.buffer(content.length);
  TransportTracer noTransportTracer = null;
  MessageFramer framer = new MessageFramer(
      new MessageFramer.Sink() {
        @Override
        public void deliverFrame(
            WritableBuffer frame, boolean endOfStream, boolean flush, int numMessages) {
          if (frame != null) {
            ByteBuf bytebuf = ((NettyWritableBuffer) frame).bytebuf();
            compressionFrame.writeBytes(bytebuf);
          }
        }
      },
      new NettyWritableBufferAllocator(ByteBufAllocator.DEFAULT),
      StatsTraceContext.NOOP);
  framer.writePayload(new ByteArrayInputStream(content));
  framer.flush();
  ChannelHandlerContext ctx = newMockContext();
  new DefaultHttp2FrameWriter().writeData(ctx, streamId, compressionFrame, 0, endStream,
      newPromise());
  return captureWrite(ctx);
}
 
开发者ID:grpc,项目名称:grpc-java,代码行数:24,代码来源:NettyHandlerTestBase.java


示例4: newHandler

import io.netty.handler.codec.http2.DefaultHttp2FrameWriter; //导入依赖的package包/类
static NettyClientHandler newHandler(
    ClientTransportLifecycleManager lifecycleManager,
    @Nullable KeepAliveManager keepAliveManager,
    int flowControlWindow,
    int maxHeaderListSize,
    Supplier<Stopwatch> stopwatchFactory,
    Runnable tooManyPingsRunnable,
    TransportTracer transportTracer) {
  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);
  WeightedFairQueueByteDistributor dist = new WeightedFairQueueByteDistributor(connection);
  dist.allocationQuantum(16 * 1024); // Make benchmarks fast again.
  DefaultHttp2RemoteFlowController controller =
      new DefaultHttp2RemoteFlowController(connection, dist);
  connection.remote().flowController(controller);

  return newHandler(
      connection,
      frameReader,
      frameWriter,
      lifecycleManager,
      keepAliveManager,
      flowControlWindow,
      maxHeaderListSize,
      stopwatchFactory,
      tooManyPingsRunnable,
      transportTracer);
}
 
开发者ID:grpc,项目名称:grpc-java,代码行数:32,代码来源:NettyClientHandler.java


示例5: initChannel

import io.netty.handler.codec.http2.DefaultHttp2FrameWriter; //导入依赖的package包/类
/**
 * Must be called by subclasses to initialize the handler and channel.
 */
protected final void initChannel(Http2HeadersDecoder headersDecoder) throws Exception {
  content = Unpooled.copiedBuffer("hello world", UTF_8);
  frameWriter = mock(Http2FrameWriter.class, delegatesTo(new DefaultHttp2FrameWriter()));
  frameReader = new DefaultHttp2FrameReader(headersDecoder);

  channel = new FakeClockSupportedChanel();
  handler = newHandler();
  channel.pipeline().addLast(handler);
  ctx = channel.pipeline().context(handler);

  writeQueue = initWriteQueue();
}
 
开发者ID:grpc,项目名称:grpc-java,代码行数:16,代码来源:NettyHandlerTestBase.java


示例6: dataFrame

import io.netty.handler.codec.http2.DefaultHttp2FrameWriter; //导入依赖的package包/类
protected final ByteBuf dataFrame(int streamId, boolean endStream, ByteBuf content) {
  // Need to retain the content since the frameWriter releases it.
  content.retain();

  ChannelHandlerContext ctx = newMockContext();
  new DefaultHttp2FrameWriter().writeData(ctx, streamId, content, 0, endStream, newPromise());
  return captureWrite(ctx);
}
 
开发者ID:grpc,项目名称:grpc-java,代码行数:9,代码来源:NettyHandlerTestBase.java


示例7: pingFrame

import io.netty.handler.codec.http2.DefaultHttp2FrameWriter; //导入依赖的package包/类
protected final ByteBuf pingFrame(boolean ack, ByteBuf payload) {
  // Need to retain the content since the frameWriter releases it.
  payload.retain();

  ChannelHandlerContext ctx = newMockContext();
  new DefaultHttp2FrameWriter().writePing(ctx, ack, payload, newPromise());
  return captureWrite(ctx);
}
 
开发者ID:grpc,项目名称:grpc-java,代码行数:9,代码来源:NettyHandlerTestBase.java


示例8: frameWriter

import io.netty.handler.codec.http2.DefaultHttp2FrameWriter; //导入依赖的package包/类
private static Http2FrameWriter frameWriter() {
  return new Http2OutboundFrameLogger(new DefaultHttp2FrameWriter(),
      FRAME_LOGGER);
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:5,代码来源:TestDtpHttp2.java


示例9: frameWriter

import io.netty.handler.codec.http2.DefaultHttp2FrameWriter; //导入依赖的package包/类
private static Http2FrameWriter frameWriter() {
    return new Http2OutboundFrameLogger(new DefaultHttp2FrameWriter(), logger);
}
 
开发者ID:duchien85,项目名称:netty-cookbook,代码行数:4,代码来源:Http2ClientInitializer.java


示例10: HelloWorldHttp2Handler

import io.netty.handler.codec.http2.DefaultHttp2FrameWriter; //导入依赖的package包/类
public HelloWorldHttp2Handler() {
    this(new DefaultHttp2Connection(true), new Http2InboundFrameLogger(
            new DefaultHttp2FrameReader(), logger), 
            new Http2OutboundFrameLogger(new DefaultHttp2FrameWriter(), logger), 
            new SimpleHttp2FrameListener());
}
 
开发者ID:duchien85,项目名称:netty-cookbook,代码行数:7,代码来源:HelloWorldHttp2Handler.java


示例11: newHandler

import io.netty.handler.codec.http2.DefaultHttp2FrameWriter; //导入依赖的package包/类
static NettyServerHandler newHandler(
    ServerTransportListener transportListener,
    ChannelPromise channelUnused,
    List<ServerStreamTracer.Factory> streamTracerFactories,
    TransportTracer transportTracer,
    int maxStreams,
    int flowControlWindow,
    int maxHeaderListSize,
    int maxMessageSize,
    long keepAliveTimeInNanos,
    long keepAliveTimeoutInNanos,
    long maxConnectionIdleInNanos,
    long maxConnectionAgeInNanos,
    long maxConnectionAgeGraceInNanos,
    boolean permitKeepAliveWithoutCalls,
    long permitKeepAliveTimeInNanos) {
  Preconditions.checkArgument(maxHeaderListSize > 0, "maxHeaderListSize must be positive");
  Http2FrameLogger frameLogger = new Http2FrameLogger(LogLevel.DEBUG, NettyServerHandler.class);
  Http2HeadersDecoder headersDecoder = new GrpcHttp2ServerHeadersDecoder(maxHeaderListSize);
  Http2FrameReader frameReader = new Http2InboundFrameLogger(
      new DefaultHttp2FrameReader(headersDecoder), frameLogger);
  Http2FrameWriter frameWriter =
      new Http2OutboundFrameLogger(new DefaultHttp2FrameWriter(), frameLogger);
  return newHandler(
      channelUnused,
      frameReader,
      frameWriter,
      transportListener,
      streamTracerFactories,
      transportTracer,
      maxStreams,
      flowControlWindow,
      maxHeaderListSize,
      maxMessageSize,
      keepAliveTimeInNanos,
      keepAliveTimeoutInNanos,
      maxConnectionIdleInNanos,
      maxConnectionAgeInNanos,
      maxConnectionAgeGraceInNanos,
      permitKeepAliveWithoutCalls,
      permitKeepAliveTimeInNanos);
}
 
开发者ID:grpc,项目名称:grpc-java,代码行数:43,代码来源:NettyServerHandler.java


示例12: headersFrame

import io.netty.handler.codec.http2.DefaultHttp2FrameWriter; //导入依赖的package包/类
protected final ByteBuf headersFrame(int streamId, Http2Headers headers) {
  ChannelHandlerContext ctx = newMockContext();
  new DefaultHttp2FrameWriter().writeHeaders(ctx, streamId, headers, 0, false, newPromise());
  return captureWrite(ctx);
}
 
开发者ID:grpc,项目名称:grpc-java,代码行数:6,代码来源:NettyHandlerTestBase.java


示例13: goAwayFrame

import io.netty.handler.codec.http2.DefaultHttp2FrameWriter; //导入依赖的package包/类
protected final ByteBuf goAwayFrame(int lastStreamId, int errorCode, ByteBuf data) {
  ChannelHandlerContext ctx = newMockContext();
  new DefaultHttp2FrameWriter().writeGoAway(ctx, lastStreamId, errorCode, data, newPromise());
  return captureWrite(ctx);
}
 
开发者ID:grpc,项目名称:grpc-java,代码行数:6,代码来源:NettyHandlerTestBase.java


示例14: rstStreamFrame

import io.netty.handler.codec.http2.DefaultHttp2FrameWriter; //导入依赖的package包/类
protected final ByteBuf rstStreamFrame(int streamId, int errorCode) {
  ChannelHandlerContext ctx = newMockContext();
  new DefaultHttp2FrameWriter().writeRstStream(ctx, streamId, errorCode, newPromise());
  return captureWrite(ctx);
}
 
开发者ID:grpc,项目名称:grpc-java,代码行数:6,代码来源:NettyHandlerTestBase.java


示例15: serializeSettings

import io.netty.handler.codec.http2.DefaultHttp2FrameWriter; //导入依赖的package包/类
protected final ByteBuf serializeSettings(Http2Settings settings) {
  ChannelHandlerContext ctx = newMockContext();
  new DefaultHttp2FrameWriter().writeSettings(ctx, settings, newPromise());
  return captureWrite(ctx);
}
 
开发者ID:grpc,项目名称:grpc-java,代码行数:6,代码来源:NettyHandlerTestBase.java


示例16: windowUpdate

import io.netty.handler.codec.http2.DefaultHttp2FrameWriter; //导入依赖的package包/类
protected final ByteBuf windowUpdate(int streamId, int delta) {
  ChannelHandlerContext ctx = newMockContext();
  new DefaultHttp2FrameWriter().writeWindowUpdate(ctx, 0, delta, newPromise());
  return captureWrite(ctx);
}
 
开发者ID:grpc,项目名称:grpc-java,代码行数:6,代码来源:NettyHandlerTestBase.java



注:本文中的io.netty.handler.codec.http2.DefaultHttp2FrameWriter类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java VectorUDT类代码示例发布时间:2022-05-23
下一篇:
Java DatatypeFormatException类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap