Home / Class/ Lz4FrameDecoderTest Class — netty Architecture

Lz4FrameDecoderTest Class — netty Architecture

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

Entity Profile

Dependency Diagram

graph TD
  6397f8d2_f5d1_2f9d_0dfd_f6f73dd0690c["Lz4FrameDecoderTest"]
  45467353_9dc5_260b_69f5_ae038de7a745["Lz4FrameDecoderTest.java"]
  6397f8d2_f5d1_2f9d_0dfd_f6f73dd0690c -->|defined in| 45467353_9dc5_260b_69f5_ae038de7a745
  a5689676_ba76_870b_fc49_c1adf755fdd9["Lz4FrameDecoderTest()"]
  6397f8d2_f5d1_2f9d_0dfd_f6f73dd0690c -->|method| a5689676_ba76_870b_fc49_c1adf755fdd9
  2a8fd8d1_e8b8_778e_64f1_69b01b385ef8["EmbeddedChannel()"]
  6397f8d2_f5d1_2f9d_0dfd_f6f73dd0690c -->|method| 2a8fd8d1_e8b8_778e_64f1_69b01b385ef8
  93f1219c_701f_eadb_425a_2cbed34fa7dc["testUnexpectedBlockIdentifier()"]
  6397f8d2_f5d1_2f9d_0dfd_f6f73dd0690c -->|method| 93f1219c_701f_eadb_425a_2cbed34fa7dc
  afd279b2_9e0a_5c66_7c85_a6eae67da5e7["testInvalidCompressedLength()"]
  6397f8d2_f5d1_2f9d_0dfd_f6f73dd0690c -->|method| afd279b2_9e0a_5c66_7c85_a6eae67da5e7
  d93094fc_010a_b9a7_9186_aa88cc228076["testInvalidDecompressedLength()"]
  6397f8d2_f5d1_2f9d_0dfd_f6f73dd0690c -->|method| d93094fc_010a_b9a7_9186_aa88cc228076
  6b1e5c18_4a83_131b_3422_e4b10aeaad2b["testDecompressedAndCompressedLengthMismatch()"]
  6397f8d2_f5d1_2f9d_0dfd_f6f73dd0690c -->|method| 6b1e5c18_4a83_131b_3422_e4b10aeaad2b
  dd6147be_532d_417c_de99_5aef5aa162d4["testUnexpectedBlockType()"]
  6397f8d2_f5d1_2f9d_0dfd_f6f73dd0690c -->|method| dd6147be_532d_417c_de99_5aef5aa162d4
  8b7d3301_116c_3334_311e_ba0fbaa26e53["testMismatchingChecksum()"]
  6397f8d2_f5d1_2f9d_0dfd_f6f73dd0690c -->|method| 8b7d3301_116c_3334_311e_ba0fbaa26e53
  520a015d_a069_c252_2e4c_634fd8571f63["testChecksumErrorOfLastBlock()"]
  6397f8d2_f5d1_2f9d_0dfd_f6f73dd0690c -->|method| 520a015d_a069_c252_2e4c_634fd8571f63
  3ad58d3c_8aa6_d07e_28c2_6fd1f7350190["compress()"]
  6397f8d2_f5d1_2f9d_0dfd_f6f73dd0690c -->|method| 3ad58d3c_8aa6_d07e_28c2_6fd1f7350190

Relationship Graph

Source Code

codec-compression/src/test/java/io/netty/handler/codec/compression/Lz4FrameDecoderTest.java lines 31–160

public class Lz4FrameDecoderTest extends AbstractDecoderTest {

    private static final byte[] DATA = { 0x4C, 0x5A, 0x34, 0x42, 0x6C, 0x6F, 0x63, 0x6B,  // magic bytes
                                         0x16,                                            // token
                                         0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,  // compr. and decompr. length
                                         (byte) 0x86, (byte) 0xE4, 0x79, 0x0F,            // checksum
                                         0x4E, 0x65, 0x74, 0x74, 0x79,                    // data
                                         0x4C, 0x5A, 0x34, 0x42, 0x6C, 0x6F, 0x63, 0x6B,  // magic bytes
                                         0x16,                                            // token
                                         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,  // last empty block
                                         0x00, 0x00, 0x00, 0x00 };

    public Lz4FrameDecoderTest() throws Exception {
    }

    @Override
    protected EmbeddedChannel createChannel() {
        return new EmbeddedChannel(new Lz4FrameDecoder(true));
    }

    @Test
    public void testUnexpectedBlockIdentifier() {
        final byte[] data = Arrays.copyOf(DATA, DATA.length);
        data[1] = 0x00;

        final ByteBuf in = Unpooled.wrappedBuffer(data);
        assertThrows(DecompressionException.class, new Executable() {
            @Override
            public void execute() {
                channel.writeInbound(in);
            }
        }, "unexpected block identifier");
    }

    @Test
    public void testInvalidCompressedLength() {
        final byte[] data = Arrays.copyOf(DATA, DATA.length);
        data[12] = (byte) 0xFF;

        final ByteBuf in = Unpooled.wrappedBuffer(data);
        assertThrows(DecompressionException.class, new Executable() {
            @Override
            public void execute() {
                channel.writeInbound(in);
            }
        }, "invalid compressedLength");
    }

    @Test
    public void testInvalidDecompressedLength() {
        final byte[] data = Arrays.copyOf(DATA, DATA.length);
        data[16] = (byte) 0xFF;

        final ByteBuf in = Unpooled.wrappedBuffer(data);
        assertThrows(DecompressionException.class, new Executable() {
            @Override
            public void execute() {
                channel.writeInbound(in);
            }
        }, "invalid decompressedLength");
    }

    @Test
    public void testDecompressedAndCompressedLengthMismatch() {
        final byte[] data = Arrays.copyOf(DATA, DATA.length);
        data[13] = 0x01;

        final ByteBuf in = Unpooled.wrappedBuffer(data);
        assertThrows(DecompressionException.class, new Executable() {
            @Override
            public void execute() {
                channel.writeInbound(in);
            }
        }, "mismatch");
    }

    @Test
    public void testUnexpectedBlockType() {
        final byte[] data = Arrays.copyOf(DATA, DATA.length);
        data[8] = 0x36;

Frequently Asked Questions

What is the Lz4FrameDecoderTest class?
Lz4FrameDecoderTest is a class in the netty codebase, defined in codec-compression/src/test/java/io/netty/handler/codec/compression/Lz4FrameDecoderTest.java.
Where is Lz4FrameDecoderTest defined?
Lz4FrameDecoderTest is defined in codec-compression/src/test/java/io/netty/handler/codec/compression/Lz4FrameDecoderTest.java at line 31.

Analyze Your Own Codebase

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

Try Supermodel Free