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

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

Introduction

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

Prototype

long MAX_CONCURRENT_STREAMS

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

Click Source Link

Usage

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

License:Open Source License

/**
 * Set the {@literal SETTINGS_MAX_CONCURRENT_STREAMS} HTTP/2 setting
 *
 * @param maxConcurrentStreams the new value
 * @return a reference to this, so the API can be used fluently
 *///from   ww  w  .  j  av  a  2 s .c  om
public Http2Settings setMaxConcurrentStreams(long maxConcurrentStreams) {
    Arguments.require(maxConcurrentStreams >= Http2CodecUtil.MIN_CONCURRENT_STREAMS,
            "maxConcurrentStreams must be >= " + Http2CodecUtil.MIN_CONCURRENT_STREAMS);
    Arguments.require(maxConcurrentStreams <= Http2CodecUtil.MAX_CONCURRENT_STREAMS,
            "maxConcurrentStreams must be < " + Http2CodecUtil.MAX_CONCURRENT_STREAMS);
    this.maxConcurrentStreams = maxConcurrentStreams;
    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  .j av a2  s.co  m*/
 */
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;
}