// 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_FRAME_HEADER_SIZE = 9;


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_FRAME_HEADER_SIZE;
import java.util.Random;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import org.junit.Before;
import org.junit.Test;
import org.mockito.InOrder;
import org.mockito.Mockito;
import static io.netty.util.ReferenceCountUtil.releaseLater;
import static org.mockito.Matchers.anyString;
import static org.mockito.Mockito.inOrder;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyNoMoreInteractions;
import static org.mockito.Mockito.verifyZeroInteractions;
    }

    @Test
    public void testInvalidClientConnectionPreface() throws Exception {
        decoder = new HttpFrameDecoder(true, delegate);
        // Only write SETTINGS frame
        int length = 0;
        byte flags = 0;
        int streamId = 0; // connection identifier

        ByteBuf frame = settingsFrame(length, flags, streamId);
        decoder.decode(frame);

        verify(delegate).readFrameError(anyString());
        verifyNoMoreInteractions(delegate);
    }

    @Test
    public void testHttpDataFrame() throws Exception {
        int length = RANDOM.nextInt() & 0x3FFF;
        byte flags = 0;
        int streamId = RANDOM.nextInt() & 0x7FFFFFFF | 0x01;

        ByteBuf frame = dataFrame(length, flags, streamId);
        writeRandomData(frame, length);
        decoder.decode(frame);

        InOrder inOrder = inOrder(delegate);
        for (int i = 0; i < length; i += 8192) {
            // data frames do not exceed maxChunkSize
// 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_FRAME_HEADER_SIZE = 9;


// Path: src/test/java/com/twitter/http2/HttpFrameDecoderTest.java
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_FRAME_HEADER_SIZE;
import java.util.Random;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import org.junit.Before;
import org.junit.Test;
import org.mockito.InOrder;
import org.mockito.Mockito;
import static io.netty.util.ReferenceCountUtil.releaseLater;
import static org.mockito.Matchers.anyString;
import static org.mockito.Mockito.inOrder;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyNoMoreInteractions;
import static org.mockito.Mockito.verifyZeroInteractions;

    }

    @Test
    public void testInvalidClientConnectionPreface() throws Exception {
        decoder = new HttpFrameDecoder(true, delegate);
        // Only write SETTINGS frame
        int length = 0;
        byte flags = 0;
        int streamId = 0; // connection identifier

        ByteBuf frame = settingsFrame(length, flags, streamId);
        decoder.decode(frame);

        verify(delegate).readFrameError(anyString());
        verifyNoMoreInteractions(delegate);
    }

    @Test
    public void testHttpDataFrame() throws Exception {
        int length = RANDOM.nextInt() & 0x3FFF;
        byte flags = 0;
        int streamId = RANDOM.nextInt() & 0x7FFFFFFF | 0x01;

        ByteBuf frame = dataFrame(length, flags, streamId);
        writeRandomData(frame, length);
        decoder.decode(frame);

        InOrder inOrder = inOrder(delegate);
        for (int i = 0; i < length; i += 8192) {
            // data frames do not exceed maxChunkSize
            int off = HTTP_FRAME_HEADER_SIZE + i;