Java 类io.netty.handler.codec.http2.Http2ConnectionEncoder 实例源码

项目:armeria    文件:HttpClientPipelineConfigurator.java   
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;
}
项目:armeria    文件:HttpServerPipelineConfigurator.java   
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;
    }
项目:chromium-net-for-android    文件:Http2TestHandler.java   
@Override
protected Http2TestHandler build(Http2ConnectionDecoder decoder,
        Http2ConnectionEncoder encoder, Http2Settings initialSettings) {
    Http2TestHandler handler = new Http2TestHandler(decoder, encoder, initialSettings);
    frameListener(handler);
    return handler;
}
项目:JavaAyo    文件:HelloWorldHttp2HandlerBuilder.java   
@Override
protected HelloWorldHttp2Handler build(Http2ConnectionDecoder decoder, Http2ConnectionEncoder encoder,
                                       Http2Settings initialSettings) {

    HelloWorldHttp2Handler handler = new HelloWorldHttp2Handler(decoder, encoder, initialSettings);
    frameListener(handler);
    return handler;
}
项目:armeria    文件:Http2ClientConnectionHandler.java   
Http2ClientConnectionHandler(
        Http2ConnectionDecoder decoder, Http2ConnectionEncoder encoder,
        Http2Settings initialSettings, Http2ResponseDecoder responseDecoder) {

    super(decoder, encoder, initialSettings);
    this.responseDecoder = responseDecoder;
    connection().addListener(responseDecoder);
    decoder().frameListener(responseDecoder);
}
项目:carbon-transports    文件:HTTP2SourceHandlerBuilder.java   
@Override
protected HTTP2SourceHandler build(Http2ConnectionDecoder decoder, Http2ConnectionEncoder encoder,
                                   Http2Settings initialSettings) {
    HTTP2SourceHandler handler = new HTTP2SourceHandler(decoder, encoder, initialSettings, connectionManager,
            listenerConfiguration);
    frameListener(handler);
    connection(new DefaultHttp2Connection(true));
    return handler;
}
项目:carbon-transports    文件:HTTP2SourceHandler.java   
HTTP2SourceHandler(Http2ConnectionDecoder decoder, Http2ConnectionEncoder encoder,
                   Http2Settings initialSettings, ConnectionManager connectionManager, ListenerConfiguration
                           listenerConfiguration) {
    super(decoder, encoder, initialSettings);
    this.listenerConfiguration = listenerConfiguration;
    this.connectionManager = connectionManager;
}
项目:xio    文件:Http2HandlerBuilder.java   
@Override
protected Http2Handler build(
    Http2ConnectionDecoder decoder,
    Http2ConnectionEncoder encoder,
    Http2Settings initialSettings) {
  return new Http2Handler(decoder, encoder, initialSettings);
}
项目:grpc-java    文件:GrpcHttp2ConnectionHandler.java   
public GrpcHttp2ConnectionHandler(
    ChannelPromise channelUnused,
    Http2ConnectionDecoder decoder,
    Http2ConnectionEncoder encoder,
    Http2Settings initialSettings) {
  super(decoder, encoder, initialSettings);
  this.channelUnused = channelUnused;
}
项目:grpc-java    文件:AbstractNettyHandler.java   
AbstractNettyHandler(
    ChannelPromise channelUnused,
    Http2ConnectionDecoder decoder,
    Http2ConnectionEncoder encoder,
    Http2Settings initialSettings) {
  super(channelUnused, decoder, encoder, initialSettings);

  // During a graceful shutdown, wait until all streams are closed.
  gracefulShutdownTimeoutMillis(GRACEFUL_SHUTDOWN_NO_TIMEOUT);

  // Extract the connection window from the settings if it was set.
  this.initialConnectionWindow = initialSettings.initialWindowSize() == null ? -1 :
          initialSettings.initialWindowSize();
}
项目:pushy    文件:TokenAuthenticationApnsClientHandler.java   
@Override
public ApnsClientHandler build(final Http2ConnectionDecoder decoder, final Http2ConnectionEncoder encoder, final Http2Settings initialSettings) {
    Objects.requireNonNull(this.authority(), "Authority must be set before building a TokenAuthenticationApnsClientHandler.");
    Objects.requireNonNull(this.signingKey(), "Signing key must be set before building a TokenAuthenticationApnsClientHandler.");

    final ApnsClientHandler handler = new TokenAuthenticationApnsClientHandler(decoder, encoder, initialSettings, this.authority(), this.signingKey(), this.idlePingIntervalMillis());
    this.frameListener(handler);
    return handler;
}
项目:chromium-net-for-android    文件:Http2TestHandler.java   
private Http2TestHandler(Http2ConnectionDecoder decoder, Http2ConnectionEncoder encoder,
        Http2Settings initialSettings) {
    super(decoder, encoder, initialSettings);
}
项目:JavaAyo    文件:HelloWorldHttp2Handler.java   
HelloWorldHttp2Handler(Http2ConnectionDecoder decoder, Http2ConnectionEncoder encoder,
                       Http2Settings initialSettings) {
    super(decoder, encoder, initialSettings);
}
项目:armeria    文件:Http2ResponseDecoder.java   
Http2ResponseDecoder(Http2Connection conn, Channel channel, Http2ConnectionEncoder encoder) {
    super(channel);
    this.conn = conn;
    this.encoder = encoder;
}
项目:armeria    文件:Http2RequestDecoder.java   
Http2RequestDecoder(ServerConfig cfg, Channel channel, Http2ConnectionEncoder writer) {
    this.cfg = cfg;
    this.writer = writer;
    inboundTrafficController = new InboundTrafficController(channel);
}
项目:armeria    文件:Http2ServerConnectionHandler.java   
Http2ServerConnectionHandler(
        Http2ConnectionDecoder decoder, Http2ConnectionEncoder encoder,
        Http2Settings initialSettings) {

    super(decoder, encoder, initialSettings);
}
项目:armeria    文件:AbstractHttp2ConnectionHandler.java   
/**
 * Creates a new instance.
 */
protected AbstractHttp2ConnectionHandler(
        Http2ConnectionDecoder decoder, Http2ConnectionEncoder encoder, Http2Settings initialSettings) {
    super(decoder, encoder, initialSettings);
}
项目:armeria    文件:Http2ObjectEncoder.java   
public Http2ObjectEncoder(Http2ConnectionEncoder encoder) {
    this.encoder = requireNonNull(encoder, "encoder");
}
项目:xio    文件:Http2Handler.java   
public Http2Handler(
    Http2ConnectionDecoder decoder,
    Http2ConnectionEncoder encoder,
    Http2Settings initialSettings) {
  super(decoder, encoder, initialSettings);
}
项目:grpc-java    文件:NettyServerHandler.java   
@VisibleForTesting
static NettyServerHandler newHandler(
    ChannelPromise channelUnused,
    Http2FrameReader frameReader,
    Http2FrameWriter frameWriter,
    ServerTransportListener transportListener,
    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(maxStreams > 0, "maxStreams must be positive");
  Preconditions.checkArgument(flowControlWindow > 0, "flowControlWindow must be positive");
  Preconditions.checkArgument(maxHeaderListSize > 0, "maxHeaderListSize must be positive");
  Preconditions.checkArgument(maxMessageSize > 0, "maxMessageSize must be positive");

  final Http2Connection connection = new DefaultHttp2Connection(true);
  WeightedFairQueueByteDistributor dist = new WeightedFairQueueByteDistributor(connection);
  dist.allocationQuantum(16 * 1024); // Make benchmarks fast again.
  DefaultHttp2RemoteFlowController controller =
      new DefaultHttp2RemoteFlowController(connection, dist);
  connection.remote().flowController(controller);
  final KeepAliveEnforcer keepAliveEnforcer = new KeepAliveEnforcer(
      permitKeepAliveWithoutCalls, permitKeepAliveTimeInNanos, TimeUnit.NANOSECONDS);

  // Create the local flow controller configured to auto-refill the connection window.
  connection.local().flowController(
      new DefaultHttp2LocalFlowController(connection, DEFAULT_WINDOW_UPDATE_RATIO, true));
  frameWriter = new WriteMonitoringFrameWriter(frameWriter, keepAliveEnforcer);
  Http2ConnectionEncoder encoder = new DefaultHttp2ConnectionEncoder(connection, frameWriter);
  Http2ConnectionDecoder decoder = new DefaultHttp2ConnectionDecoder(connection, encoder,
      frameReader);

  Http2Settings settings = new Http2Settings();
  settings.initialWindowSize(flowControlWindow);
  settings.maxConcurrentStreams(maxStreams);
  settings.maxHeaderListSize(maxHeaderListSize);

  return new NettyServerHandler(
      channelUnused,
      connection,
      transportListener,
      streamTracerFactories,
      transportTracer,
      decoder, encoder, settings,
      maxMessageSize,
      keepAliveTimeInNanos, keepAliveTimeoutInNanos,
      maxConnectionIdleInNanos,
      maxConnectionAgeInNanos, maxConnectionAgeGraceInNanos,
      keepAliveEnforcer);
}
项目:pushy    文件:TokenAuthenticationApnsClientHandler.java   
protected TokenAuthenticationApnsClientHandler(final Http2ConnectionDecoder decoder, final Http2ConnectionEncoder encoder, final Http2Settings initialSettings, final String authority, final ApnsSigningKey signingKey, final long idlePingIntervalMillis) {
    super(decoder, encoder, initialSettings, authority, idlePingIntervalMillis);

    Objects.requireNonNull(signingKey, "Signing key must not be null for token-based client handlers.");
    this.signingKey = signingKey;
}