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

项目:nitmproxy    文件:Http2FrontendHandler.java   
@Override
public void handlerAdded(ChannelHandlerContext ctx) throws Exception {
    LOGGER.info("{} : handlerAdded", connectionInfo);

    Http2Connection connection = new DefaultHttp2Connection(true);
    ChannelHandler http2ConnHandler = new HttpToHttp2ConnectionHandlerBuilder()
            .frameListener(new DelegatingDecompressorFrameListener(
                    connection,
                    new InboundHttp2ToHttpAdapterBuilder(connection)
                            .maxContentLength(master.config().getMaxContentLength())
                            .propagateSettings(true)
                            .build()))
            .connection(connection)
            .frameLogger(new Http2FrameLogger(LogLevel.DEBUG))
            .build();
    ctx.pipeline()
       .addBefore(ctx.name(), null, http2ConnHandler)
       .addBefore(ctx.name(), null, new Http2Handler());
}
项目:nitmproxy    文件:Http2BackendHandler.java   
@Override
public void handlerAdded(ChannelHandlerContext ctx) throws Exception {
    LOGGER.info("{} : handlerAdded", connectionInfo);

    Http2Connection connection = new DefaultHttp2Connection(false);
    ChannelHandler http2ConnHandler = new HttpToHttp2ConnectionHandlerBuilder()
            .frameListener(new DelegatingDecompressorFrameListener(
                    connection,
                    new InboundHttp2ToHttpAdapterBuilder(connection)
                            .maxContentLength(master.config().getMaxContentLength())
                            .propagateSettings(true)
                            .build()))
            .frameLogger(new Http2FrameLogger(LogLevel.DEBUG))
            .connection(connection)
            .build();
    ctx.pipeline()
       .addBefore(ctx.name(), null, http2ConnHandler)
       .addBefore(ctx.name(), null, new Http2Handler());
}
项目:jooby    文件:NettyPipeline.java   
private Http2ConnectionHandler newHttp2ConnectionHandler(final ChannelPipeline p) {
  DefaultHttp2Connection connection = new DefaultHttp2Connection(true);
  InboundHttp2ToHttpAdapter listener = new InboundHttp2ToHttpAdapterBuilder(connection)
      .propagateSettings(false)
      .validateHttpHeaders(false)
      .maxContentLength(maxContentLength)
      .build();

  HttpToHttp2ConnectionHandler http2handler = new HttpToHttp2ConnectionHandlerBuilder()
      .frameListener(listener)
      .frameLogger(new Http2FrameLogger(LogLevel.DEBUG))
      .connection(connection)
      .build();

  return http2handler;
}
项目:grpc-java    文件:NettyServerHandler.java   
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);
}
项目:pushy    文件:ApnsClient.java   
protected ApnsClient(final InetSocketAddress apnsServerAddress, final SslContext sslContext,
                     final ApnsSigningKey signingKey, final ProxyHandlerFactory proxyHandlerFactory,
                     final int connectTimeoutMillis, final long idlePingIntervalMillis,
                     final long gracefulShutdownTimeoutMillis, final int concurrentConnections,
                     final ApnsClientMetricsListener metricsListener, final Http2FrameLogger frameLogger,
                     final EventLoopGroup eventLoopGroup) {

    if (eventLoopGroup != null) {
        this.eventLoopGroup = eventLoopGroup;
        this.shouldShutDownEventLoopGroup = false;
    } else {
        this.eventLoopGroup = new NioEventLoopGroup(1);
        this.shouldShutDownEventLoopGroup = true;
    }

    this.metricsListener = metricsListener != null ? metricsListener : new NoopApnsClientMetricsListener();

    final ApnsChannelFactory channelFactory = new ApnsChannelFactory(sslContext, signingKey, proxyHandlerFactory,
            connectTimeoutMillis, idlePingIntervalMillis, gracefulShutdownTimeoutMillis, frameLogger,
            apnsServerAddress, this.eventLoopGroup);

    final ApnsChannelPoolMetricsListener channelPoolMetricsListener = new ApnsChannelPoolMetricsListener() {

        @Override
        public void handleConnectionAdded() {
            ApnsClient.this.metricsListener.handleConnectionAdded(ApnsClient.this);
        }

        @Override
        public void handleConnectionRemoved() {
            ApnsClient.this.metricsListener.handleConnectionRemoved(ApnsClient.this);
        }

        @Override
        public void handleConnectionCreationFailed() {
            ApnsClient.this.metricsListener.handleConnectionCreationFailed(ApnsClient.this);
        }
    };

    this.channelPool = new ApnsChannelPool(channelFactory, concurrentConnections, this.eventLoopGroup.next(), channelPoolMetricsListener);
}
项目:pushy    文件:ApnsClientBuilder.java   
/**
 * Sets the HTTP/2 frame logger for the client under construction. HTTP/2 frame loggers log all HTTP/2 frames sent
 * to or from the client to the logging system of your choice via SLF4J. Frame logging is extremely verbose and is
 * recommended only for debugging purposes.
 *
 * @param frameLogger the frame logger to be used by the client under construction or {@code null} if the client
 * should not log individual HTTP/2 frames
 *
 * @return a reference to this builder
 *
 * @see <a href="https://www.slf4j.org/">SLF4J</a>
 *
 * @since 0.12
 */
public ApnsClientBuilder setFrameLogger(final Http2FrameLogger frameLogger) {
    this.frameLogger = frameLogger;
    return this;
}