Home / Function/ testEncoderSanitizingMultiByteCharacters() — netty Function Reference

testEncoderSanitizingMultiByteCharacters() — netty Function Reference

Architecture documentation for the testEncoderSanitizingMultiByteCharacters() function in HpackHuffmanTest.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  abeb730a_2dc5_f18d_e1f4_542dd303b675["testEncoderSanitizingMultiByteCharacters()"]
  0e9c37ed_3d42_0ea4_35fa_9ba9ae495d19["HpackHuffmanTest"]
  abeb730a_2dc5_f18d_e1f4_542dd303b675 -->|defined in| 0e9c37ed_3d42_0ea4_35fa_9ba9ae495d19
  e1a530c8_fa65_c1c4_5bdb_eceed12e84ae["decode()"]
  abeb730a_2dc5_f18d_e1f4_542dd303b675 -->|calls| e1a530c8_fa65_c1c4_5bdb_eceed12e84ae
  style abeb730a_2dc5_f18d_e1f4_542dd303b675 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

codec-http2/src/test/java/io/netty/handler/codec/http2/HpackHuffmanTest.java lines 167–198

    @Test
    public void testEncoderSanitizingMultiByteCharacters() throws Http2Exception {
        final int inputLen = 500;
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < inputLen; i++) {
            // Starts with 0x4E01 because certain suboptimal sanitization could cause some problem with this input.
            // For example, if a multibyte character C is sanitized by doing (C & OxFF), if C == 0x4E01, then
            // (0x4E01 & OxFF) is greater than zero which indicates insufficient sanitization.
            sb.append((char) (0x4E01 + i));
        }
        HpackHuffmanEncoder encoder = new HpackHuffmanEncoder();
        String toBeEncoded = sb.toString();
        ByteBuf buffer = Unpooled.buffer();
        byte[] bytes;
        try {
            encoder.encode(buffer, toBeEncoded);
            bytes = new byte[buffer.readableBytes()];
            buffer.readBytes(bytes);
        } finally {
            buffer.release(); // Release as soon as possible.
        }
        byte[] actualBytes = decode(bytes);
        String actualDecoded = new String(actualBytes);
        char[] charArray = new char[inputLen];
        Arrays.fill(charArray, '?');
        String expectedDecoded = new String(charArray);
        assertEquals(
                expectedDecoded,
                actualDecoded,
                "Expect the decoded string to be sanitized and contains only '?' characters."
        );
    }

Domain

Subdomains

Calls

Frequently Asked Questions

What does testEncoderSanitizingMultiByteCharacters() do?
testEncoderSanitizingMultiByteCharacters() is a function in the netty codebase, defined in codec-http2/src/test/java/io/netty/handler/codec/http2/HpackHuffmanTest.java.
Where is testEncoderSanitizingMultiByteCharacters() defined?
testEncoderSanitizingMultiByteCharacters() is defined in codec-http2/src/test/java/io/netty/handler/codec/http2/HpackHuffmanTest.java at line 167.
What does testEncoderSanitizingMultiByteCharacters() call?
testEncoderSanitizingMultiByteCharacters() calls 1 function(s): decode.

Analyze Your Own Codebase

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

Try Supermodel Free