Example usage for io.netty.handler.codec.http2 Http2CodecUtil MAX_HEADER_LIST_SIZE

List of usage examples for io.netty.handler.codec.http2 Http2CodecUtil MAX_HEADER_LIST_SIZE

Introduction

In this page you can find the example usage for io.netty.handler.codec.http2 Http2CodecUtil MAX_HEADER_LIST_SIZE.

Prototype

long MAX_HEADER_LIST_SIZE

To view the source code for io.netty.handler.codec.http2 Http2CodecUtil MAX_HEADER_LIST_SIZE.

Click Source Link

Usage

From source file:io.vertx.test.core.TestUtils.java

License:Open Source License

/**
 * Create random {@link Http2Settings} with valid values.
 * @return the random settings//from   w  w  w  .  j  a  v a  2 s . c om
 */
public static Http2Settings randomHttp2Settings() {
    long headerTableSize = 10 + randomPositiveInt() % (Http2CodecUtil.MAX_HEADER_TABLE_SIZE - 10);
    boolean enablePush = randomBoolean();
    long maxConcurrentStreams = 10 + randomPositiveLong() % (Http2CodecUtil.MAX_CONCURRENT_STREAMS - 10);
    int initialWindowSize = 10 + randomPositiveInt() % (Http2CodecUtil.MAX_INITIAL_WINDOW_SIZE - 10);
    int maxFrameSize = Http2CodecUtil.MAX_FRAME_SIZE_LOWER_BOUND + randomPositiveInt()
            % (Http2CodecUtil.MAX_FRAME_SIZE_UPPER_BOUND - Http2CodecUtil.MAX_FRAME_SIZE_LOWER_BOUND);
    long maxHeaderListSize = 10 + randomPositiveLong() % (Http2CodecUtil.MAX_HEADER_LIST_SIZE - 10);
    Http2Settings settings = new Http2Settings();
    settings.setHeaderTableSize(headerTableSize);
    settings.setPushEnabled(enablePush);
    settings.setMaxConcurrentStreams(maxConcurrentStreams);
    settings.setInitialWindowSize(initialWindowSize);
    settings.setMaxFrameSize(maxFrameSize);
    settings.setMaxHeaderListSize(maxHeaderListSize);
    settings.set('\u0007', (randomPositiveLong() & 0xFFFFFFFFL));
    return settings;
}