All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.hyperfoil.http.connection.Http2ConnectionHandlerBuilder Maven / Gradle / Ivy

There is a newer version: 0.27.1
Show newest version
package io.hyperfoil.http.connection;

import java.util.function.BiConsumer;

import io.hyperfoil.http.api.HttpClientPool;
import io.hyperfoil.http.api.HttpConnection;
import io.netty.handler.codec.http2.AbstractHttp2ConnectionHandlerBuilder;
import io.netty.handler.codec.http2.Http2ConnectionDecoder;
import io.netty.handler.codec.http2.Http2ConnectionEncoder;
import io.netty.handler.codec.http2.Http2EventAdapter;
import io.netty.handler.codec.http2.Http2Settings;

class Http2ConnectionHandlerBuilder extends AbstractHttp2ConnectionHandlerBuilder {

   private final HttpClientPool clientPool;
   private final boolean isUpgrade;
   private final BiConsumer requestHandler;

   Http2ConnectionHandlerBuilder(HttpClientPool clientPool, boolean isUpgrade, BiConsumer requestHandler) {
      this.clientPool = clientPool;
      this.isUpgrade = isUpgrade;
      this.requestHandler = requestHandler;
   }

   @Override
   protected CustomHttp2ConnectionHandler build(Http2ConnectionDecoder decoder, Http2ConnectionEncoder encoder, Http2Settings initialSettings) {
      return new CustomHttp2ConnectionHandler(clientPool, requestHandler, decoder, encoder, initialSettings, isUpgrade);
   }

   public CustomHttp2ConnectionHandler build(io.netty.handler.codec.http2.Http2Connection conn) {
      connection(conn);
      frameListener(new Http2EventAdapter() { /* Dunno why this is needed */});
      return super.build();
   }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy