use of com.webpieces.http2.api.dto.lowlevel.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());
}
use of com.webpieces.http2.api.dto.lowlevel.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);
}
use of com.webpieces.http2.api.dto.lowlevel.PriorityFrame in project webpieces by deanhiller.
the class TestC5x1StreamStates method testSection5_1ReceivePriorityAfterReceiveRstStreamFrame.
/**
* An endpoint MUST NOT send frames other than ----PRIORITY---- on a closed stream. An endpoint
* that receives any frame other than ----PRIORITY---- after receiving a ----RST_STREAM---- MUST
* treat that as a stream error (Section 5.4.2) of type STREAM_CLOSED. Similarly, an
* endpoint that receives any frames after receiving a frame with the
* END_STREAM flag set MUST treat that as a connection error (Section 5.4.1) of
* type STREAM_CLOSED, unless the frame is permitted as described below.
*/
@Test
public void testSection5_1ReceivePriorityAfterReceiveRstStreamFrame() {
MockResponseListener listener1 = new MockResponseListener();
listener1.setIncomingRespDefault(XFuture.<StreamWriter>completedFuture(null));
Http2Request request = sendRequestToServer(listener1);
sendResetFromServer(listener1, request);
PriorityDetails details = new PriorityDetails();
details.setStreamDependency(3);
PriorityFrame dataFrame = new PriorityFrame(request.getStreamId(), details);
mockChannel.write(dataFrame);
// priority is ignored
Assert.assertEquals(0, mockChannel.getFramesAndClear().size());
Assert.assertFalse(mockChannel.isClosed());
Assert.assertEquals(0, listener1.getReturnValuesIncomingResponse().size());
}
Aggregations