// 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 frame = releaseLater(
                ENCODER.encodeWindowUpdateFrame(streamId, windowSizeIncrement)
        );
        assertWindowUpdateFrame(frame, streamId, windowSizeIncrement);
    }

    private static void assertDataFrame(ByteBuf frame, int streamId, boolean last, ByteBuf data) {
        byte type = 0x00;
        byte flags = 0x00;
        if (last) {
            flags |= 0x01;
        }
        int length = assertFrameHeader(frame, type, flags, streamId);
        assertEquals(data.readableBytes(), length);
        for (int i = 0; i < length; i++) {
            assertEquals(data.getByte(i), frame.readByte());
        }
        assertFalse(frame.isReadable());
    }

    private static void assertHeadersFrame(
            ByteBuf frame,
            int streamId,
            boolean exclusive,
            int dependency,
            int weight,
            boolean last,
            ByteBuf headerBlock
    ) {
        boolean hasPriority =
// 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 frame = releaseLater(
                ENCODER.encodeWindowUpdateFrame(streamId, windowSizeIncrement)
        );
        assertWindowUpdateFrame(frame, streamId, windowSizeIncrement);
    }

    private static void assertDataFrame(ByteBuf frame, int streamId, boolean last, ByteBuf data) {
        byte type = 0x00;
        byte flags = 0x00;
        if (last) {
            flags |= 0x01;
        }
        int length = assertFrameHeader(frame, type, flags, streamId);
        assertEquals(data.readableBytes(), length);
        for (int i = 0; i < length; i++) {
            assertEquals(data.getByte(i), frame.readByte());
        }
        assertFalse(frame.isReadable());
    }

    private static void assertHeadersFrame(
            ByteBuf frame,
            int streamId,
            boolean exclusive,
            int dependency,
            int weight,
            boolean last,
            ByteBuf headerBlock
    ) {
        boolean hasPriority =
                exclusive || dependency != HTTP_DEFAULT_DEPENDENCY || weight != HTTP_DEFAULT_WEIGHT;