io.netty.handler.codec.http2.Http2FrameAdapter Java Examples
The following examples show how to use
io.netty.handler.codec.http2.Http2FrameAdapter.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: NoPriorityByteDistributionBenchmark.java From netty-4.1.22 with Apache License 2.0 | 5 votes |
@Setup(Level.Trial) public void setupTrial() throws Exception { connection = new DefaultHttp2Connection(false); dataRefresherKey = connection.newKey(); // Create the flow controller switch (algorithm) { case WFQ: distributor = new WeightedFairQueueByteDistributor(connection, 0); break; case UNIFORM: distributor = new UniformStreamByteDistributor(connection); break; } controller = new DefaultHttp2RemoteFlowController(connection, new ByteCounter(distributor)); connection.remote().flowController(controller); Http2ConnectionHandler handler = new Http2ConnectionHandlerBuilder() .encoderEnforceMaxConcurrentStreams(false).validateHeaders(false) .frameListener(new Http2FrameAdapter()) .connection(connection) .build(); ctx = new EmbeddedChannelWriteReleaseHandlerContext(PooledByteBufAllocator.DEFAULT, handler) { @Override protected void handleException(Throwable t) { handleUnexpectedException(t); } }; handler.handlerAdded(ctx); handler.channelActive(ctx); // Create the streams, each initialized with MAX_INT bytes. for (int i = 0; i < numStreams; ++i) { Http2Stream stream = connection.local().createStream(toStreamId(i), false); addData(stream, Integer.MAX_VALUE); stream.setProperty(dataRefresherKey, new DataRefresher(stream)); } }