Home / Class/ Http3TestUtils Class — netty Architecture

Http3TestUtils Class — netty Architecture

Architecture documentation for the Http3TestUtils class in Http3TestUtils.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  526452ea_0bd7_0aa9_3ccc_c662ad6d889a["Http3TestUtils"]
  10fcbdcc_5593_b594_579c_168aabfc61ad["Http3TestUtils.java"]
  526452ea_0bd7_0aa9_3ccc_c662ad6d889a -->|defined in| 10fcbdcc_5593_b594_579c_168aabfc61ad
  0062f447_a31c_f185_4c01_db697bb23d10["Http3TestUtils()"]
  526452ea_0bd7_0aa9_3ccc_c662ad6d889a -->|method| 0062f447_a31c_f185_4c01_db697bb23d10
  fd3608f2_0993_aee0_e370_7d3aea7b7ad7["assertException()"]
  526452ea_0bd7_0aa9_3ccc_c662ad6d889a -->|method| fd3608f2_0993_aee0_e370_7d3aea7b7ad7
  74fc0dfa_41f1_3d12_02da_8359a13ec398["verifyClose()"]
  526452ea_0bd7_0aa9_3ccc_c662ad6d889a -->|method| 74fc0dfa_41f1_3d12_02da_8359a13ec398
  da59f66c_75ac_d52b_f6cf_bbe67fd6c809["assertBufferEquals()"]
  526452ea_0bd7_0aa9_3ccc_c662ad6d889a -->|method| da59f66c_75ac_d52b_f6cf_bbe67fd6c809
  0e9ac054_2c1e_c9ff_4849_5fad8e6bd23b["assertFrameEquals()"]
  526452ea_0bd7_0aa9_3ccc_c662ad6d889a -->|method| 0e9ac054_2c1e_c9ff_4849_5fad8e6bd23b
  fa6fb464_7b07_70c1_580f_e0e9d4aea6d9["assertFrameSame()"]
  526452ea_0bd7_0aa9_3ccc_c662ad6d889a -->|method| fa6fb464_7b07_70c1_580f_e0e9d4aea6d9
  25cbecc1_8da6_967a_89ad_baf6a3eb0ed6["assertFrameReleased()"]
  526452ea_0bd7_0aa9_3ccc_c662ad6d889a -->|method| 25cbecc1_8da6_967a_89ad_baf6a3eb0ed6
  ab53fc50_7dac_1ed7_80d8_e6efffbd5e7f["Http3Frame()"]
  526452ea_0bd7_0aa9_3ccc_c662ad6d889a -->|method| ab53fc50_7dac_1ed7_80d8_e6efffbd5e7f
  631f364a_bf61_1a32_7c82_3e070bc0cbf0["Http3PushStreamFrame()"]
  526452ea_0bd7_0aa9_3ccc_c662ad6d889a -->|method| 631f364a_bf61_1a32_7c82_3e070bc0cbf0
  892db088_9d3a_e787_34b2_db780c5c32b0["Http3RequestStreamFrame()"]
  526452ea_0bd7_0aa9_3ccc_c662ad6d889a -->|method| 892db088_9d3a_e787_34b2_db780c5c32b0
  6cb6cf40_eb78_07e9_1584_6857e332ac0b["Http3ControlStreamFrame()"]
  526452ea_0bd7_0aa9_3ccc_c662ad6d889a -->|method| 6cb6cf40_eb78_07e9_1584_6857e332ac0b
  aa46f377_f989_1a51_006f_8575ec95ad24["DefaultHttp3HeadersFrame()"]
  526452ea_0bd7_0aa9_3ccc_c662ad6d889a -->|method| aa46f377_f989_1a51_006f_8575ec95ad24

Relationship Graph

Source Code

codec-http3/src/test/java/io/netty/handler/codec/http3/Http3TestUtils.java lines 27–103

final class Http3TestUtils {

    private Http3TestUtils() { }

    static void assertException(Http3ErrorCode code, Throwable e) {
        MatcherAssert.assertThat(e, CoreMatchers.instanceOf(Http3Exception.class));
        Http3Exception exception = (Http3Exception) e;
        assertEquals(code, exception.errorCode());
    }

    static void verifyClose(int times, Http3ErrorCode expectedCode, EmbeddedQuicChannel channel) {
        assertEquals(times, channel.closeErrorCodes().stream().filter(integer -> integer == expectedCode.code).count(),
                "Close not invoked with expected times with error code: " + expectedCode.code);
    }

    static void verifyClose(Http3ErrorCode expectedCode, EmbeddedQuicChannel channel) {
        verifyClose(1, expectedCode, channel);
    }

    static void assertBufferEquals(ByteBuf expected, ByteBuf actual) {
        try {
            assertEquals(expected, actual);
        } finally {
            ReferenceCountUtil.release(expected);
            ReferenceCountUtil.release(actual);
        }
    }

    static void assertFrameEquals(Http3Frame expected, Http3Frame actual) {
        try {
            assertEquals(expected, actual);
        } finally {
            ReferenceCountUtil.release(expected);
            ReferenceCountUtil.release(actual);
        }
    }

    static void assertFrameSame(Http3Frame expected, Http3Frame actual) {
        try {
            assertSame(expected, actual);
        } finally {
            // as both frames are the same we only want to release once.
            ReferenceCountUtil.release(actual);
        }
    }

    static void assertFrameReleased(Http3Frame frame) {
        if (frame instanceof ReferenceCounted) {
            assertEquals(0, ((ReferenceCounted) frame).refCnt());
        }
    }

    static Http3Frame newHttp3Frame() {
        return ()  -> 0;
    }

    static Http3PushStreamFrame newHttp3PushStreamFrame() {
        return ()  -> 0;
    }

    static Http3RequestStreamFrame newHttp3RequestStreamFrame() {
        return ()  -> 0;
    }

    static Http3ControlStreamFrame newHttp3ControlStreamFrame() {
        return ()  -> 0;
    }

    static DefaultHttp3HeadersFrame newHeadersFrameWithPseudoHeaders() {
        final DefaultHttp3HeadersFrame headers = new DefaultHttp3HeadersFrame();
        headers.headers().add(":authority", "netty.quic"); // name only
        headers.headers().add(":path", "/"); // name & value
        headers.headers().add(":method", "GET"); // name & value with few options per name
        headers.headers().add(":scheme", "https");
        return headers;
    }
}

Frequently Asked Questions

What is the Http3TestUtils class?
Http3TestUtils is a class in the netty codebase, defined in codec-http3/src/test/java/io/netty/handler/codec/http3/Http3TestUtils.java.
Where is Http3TestUtils defined?
Http3TestUtils is defined in codec-http3/src/test/java/io/netty/handler/codec/http3/Http3TestUtils.java at line 27.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free