Search in sources :

Example 6 with PriorityFrame

use of com.webpieces.http2parser.api.dto.PriorityFrame in project webpieces by deanhiller.

the class TestHttp2Priority method testMarshalPriorityFrame.

@Test
public void testMarshalPriorityFrame() {
    PriorityFrame frame = new PriorityFrame();
    frame.setStreamId(1);
    PriorityDetails details = frame.getPriorityDetails();
    details.setStreamDependency(4);
    details.setStreamDependencyIsExclusive(true);
    details.setWeight((short) 0x5);
    byte[] data = parser.marshal(frame).createByteArray();
    String hexFrame = Util.toHexString(data);
    Assert.assertEquals(priorityFrame(), hexFrame);
}
Also used : PriorityDetails(com.webpieces.http2parser.api.dto.lib.PriorityDetails) PriorityFrame(com.webpieces.http2parser.api.dto.PriorityFrame) Test(org.junit.Test)

Example 7 with PriorityFrame

use of com.webpieces.http2parser.api.dto.PriorityFrame in project webpieces by deanhiller.

the class TestHttp2Priority method testParsePriorityFrameMSB.

@Test
public void testParsePriorityFrameMSB() {
    DataWrapper data = Util.hexToBytes(priorityFrameMSB());
    parser.parse(memento, data);
    PriorityFrame frame = (PriorityFrame) assertGood();
    Assert.assertEquals(1, frame.getStreamId());
    PriorityDetails details = frame.getPriorityDetails();
    Assert.assertTrue(details.isStreamDependencyIsExclusive());
    Assert.assertEquals(255, details.getWeight());
    Assert.assertEquals(4, details.getStreamDependency());
}
Also used : DataWrapper(org.webpieces.data.api.DataWrapper) PriorityDetails(com.webpieces.http2parser.api.dto.lib.PriorityDetails) PriorityFrame(com.webpieces.http2parser.api.dto.PriorityFrame) Test(org.junit.Test)

Aggregations

PriorityFrame (com.webpieces.http2parser.api.dto.PriorityFrame)7 PriorityDetails (com.webpieces.http2parser.api.dto.lib.PriorityDetails)7 Test (org.junit.Test)5 DataWrapper (org.webpieces.data.api.DataWrapper)3 Http2Request (com.webpieces.hpack.api.dto.Http2Request)1 ConnectionException (com.webpieces.http2parser.api.dto.error.ConnectionException)1 StreamException (com.webpieces.http2parser.api.dto.error.StreamException)1 FrameHeaderData (com.webpieces.http2parser.impl.FrameHeaderData)1 ByteBuffer (java.nio.ByteBuffer)1 MockResponseListener (org.webpieces.http2client.mock.MockResponseListener)1