// Path: src/main/java/com/twitter/http2/HttpCodecUtil.java
// static final int HTTP_DEFAULT_DEPENDENCY = 0;
// 
// Path: src/main/java/com/twitter/http2/HttpCodecUtil.java
// static final int HTTP_DEFAULT_WEIGHT = 16;
// 
// Path: src/main/java/com/twitter/http2/HttpCodecUtil.java
// static final int HTTP_MAX_LENGTH = 0x4000; // Initial MAX_FRAME_SIZE value is 2^14


import java.util.Random;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import org.junit.Test;
import static io.netty.util.ReferenceCountUtil.releaseLater;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static com.twitter.http2.HttpCodecUtil.HTTP_DEFAULT_DEPENDENCY;
import static com.twitter.http2.HttpCodecUtil.HTTP_DEFAULT_WEIGHT;
import static com.twitter.http2.HttpCodecUtil.HTTP_MAX_LENGTH;
        ByteBuf headerBlock = Unpooled.buffer(1024);
        for (int i = 0; i < 256; i++) {
            headerBlock.writeInt(RANDOM.nextInt());
        }
        ByteBuf frame = releaseLater(
                ENCODER.encodeHeadersFrame(
                        streamId, false, exclusive, dependency, weight, headerBlock.duplicate())
        );
        assertHeadersFrame(frame, streamId, exclusive, dependency, weight, false, headerBlock);
    }

    @Test
    public void testEmptyHttpHeadersFrame() throws Exception {
        int streamId = RANDOM.nextInt() & 0x7FFFFFFF | 0x01;
        boolean exclusive = RANDOM.nextBoolean();
        int dependency = RANDOM.nextInt() & 0x7FFFFFFF;
        int weight = (RANDOM.nextInt() & 0xFF) + 1;
        ByteBuf frame = releaseLater(
                ENCODER.encodeHeadersFrame(
                        streamId, false, exclusive, dependency, weight, Unpooled.EMPTY_BUFFER)
        );
        assertHeadersFrame(
                frame, streamId, exclusive, dependency, weight, false, Unpooled.EMPTY_BUFFER);
    }

    @Test
    public void testLastHttpHeadersFrame() throws Exception {
        int streamId = RANDOM.nextInt() & 0x7FFFFFFF | 0x01;
        boolean exclusive = false;
        int dependency = HTTP_DEFAULT_DEPENDENCY;
// Path: src/main/java/com/twitter/http2/HttpCodecUtil.java
// static final int HTTP_DEFAULT_DEPENDENCY = 0;
// 
// Path: src/main/java/com/twitter/http2/HttpCodecUtil.java
// static final int HTTP_DEFAULT_WEIGHT = 16;
// 
// Path: src/main/java/com/twitter/http2/HttpCodecUtil.java
// static final int HTTP_MAX_LENGTH = 0x4000; // Initial MAX_FRAME_SIZE value is 2^14


// Path: src/test/java/com/twitter/http2/HttpFrameEncoderTest.java
import java.util.Random;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import org.junit.Test;
import static io.netty.util.ReferenceCountUtil.releaseLater;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static com.twitter.http2.HttpCodecUtil.HTTP_DEFAULT_DEPENDENCY;
import static com.twitter.http2.HttpCodecUtil.HTTP_DEFAULT_WEIGHT;
import static com.twitter.http2.HttpCodecUtil.HTTP_MAX_LENGTH;

        ByteBuf headerBlock = Unpooled.buffer(1024);
        for (int i = 0; i < 256; i++) {
            headerBlock.writeInt(RANDOM.nextInt());
        }
        ByteBuf frame = releaseLater(
                ENCODER.encodeHeadersFrame(
                        streamId, false, exclusive, dependency, weight, headerBlock.duplicate())
        );
        assertHeadersFrame(frame, streamId, exclusive, dependency, weight, false, headerBlock);
    }

    @Test
    public void testEmptyHttpHeadersFrame() throws Exception {
        int streamId = RANDOM.nextInt() & 0x7FFFFFFF | 0x01;
        boolean exclusive = RANDOM.nextBoolean();
        int dependency = RANDOM.nextInt() & 0x7FFFFFFF;
        int weight = (RANDOM.nextInt() & 0xFF) + 1;
        ByteBuf frame = releaseLater(
                ENCODER.encodeHeadersFrame(
                        streamId, false, exclusive, dependency, weight, Unpooled.EMPTY_BUFFER)
        );
        assertHeadersFrame(
                frame, streamId, exclusive, dependency, weight, false, Unpooled.EMPTY_BUFFER);
    }

    @Test
    public void testLastHttpHeadersFrame() throws Exception {
        int streamId = RANDOM.nextInt() & 0x7FFFFFFF | 0x01;
        boolean exclusive = false;
        int dependency = HTTP_DEFAULT_DEPENDENCY;
        int weight = HTTP_DEFAULT_WEIGHT;