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

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

Introduction

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

Prototype

int MAX_FRAME_SIZE_UPPER_BOUND

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

Click Source Link

Usage

From source file:io.vertx.core.http.Http2Settings.java

License:Open Source License

/**
 * Set the {@literal SETTINGS_MAX_FRAME_SIZE} HTTP/2 setting
 *
 * @param maxFrameSize the new value//from   w  ww.  j  a v a2 s .  c om
 * @return a reference to this, so the API can be used fluently
 */
public Http2Settings setMaxFrameSize(int maxFrameSize) {
    Arguments.require(maxFrameSize >= Http2CodecUtil.MAX_FRAME_SIZE_LOWER_BOUND,
            "maxFrameSize must be >= " + Http2CodecUtil.MAX_FRAME_SIZE_LOWER_BOUND);
    Arguments.require(maxFrameSize <= Http2CodecUtil.MAX_FRAME_SIZE_UPPER_BOUND,
            "maxFrameSize must be <= " + Http2CodecUtil.MAX_FRAME_SIZE_UPPER_BOUND);
    this.maxFrameSize = maxFrameSize;
    return this;
}

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

License:Open Source License

/**
 * Create random {@link Http2Settings} with valid values.
 * @return the random settings/*ww  w  . ja  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;
}