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

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

Introduction

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

Prototype

short DEFAULT_PRIORITY_WEIGHT

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

Click Source Link

Usage

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

License:Open Source License

@Test
public void testDefaultStreamWeightAndDependency() throws Exception {
    int defaultStreamDependency = 0;
    short defaultStreamWeight = Http2CodecUtil.DEFAULT_PRIORITY_WEIGHT;
    waitFor(2);//www.  j a v a 2s. com
    server.requestHandler(req -> {
        assertEquals(defaultStreamWeight, req.streamPriority().getWeight());
        assertEquals(defaultStreamDependency, req.streamPriority().getDependency());
        req.response().end();
        complete();
    });
    startServer(testAddress);
    client = vertx
            .createHttpClient(createBaseClientOptions().setHttp2KeepAliveTimeout(3).setPoolCleanerPeriod(1));
    HttpClientRequest request = client.request(HttpMethod.GET, testAddress, DEFAULT_HTTP_PORT,
            DEFAULT_HTTP_HOST, DEFAULT_TEST_URI, onSuccess(resp -> {
                assertEquals(defaultStreamWeight, resp.request().getStreamPriority().getWeight());
                assertEquals(defaultStreamDependency, resp.request().getStreamPriority().getDependency());
                complete();
            }));
    request.end();
    await();
}