use of com.webpieces.http2.api.dto.lowlevel.DataFrame in project webpieces by deanhiller.
the class Http11ToHttp2 method translateBody.
public static DataFrame translateBody(DataWrapper body) {
DataFrame data = new DataFrame();
data.setData(body);
data.setEndOfStream(true);
return data;
}
use of com.webpieces.http2.api.dto.lowlevel.DataFrame in project webpieces by deanhiller.
the class TestHttp2Data method testParsePaddedData.
@Test
public void testParsePaddedData() {
DataWrapper data = Util.hexToBytes(paddedDataFrame());
parser.parse(memento, data);
DataFrame frame = (DataFrame) assertGood();
Assert.assertEquals(1, frame.getStreamId());
Assert.assertEquals(8, frame.getData().getReadableSize());
Assert.assertEquals(2, frame.getPadding().getReadableSize());
Assert.assertTrue(frame.isEndOfStream());
}
use of com.webpieces.http2.api.dto.lowlevel.DataFrame in project webpieces by deanhiller.
the class TestHttp2Data method testMarshalDataFrameEndStream.
@Test
public void testMarshalDataFrameEndStream() {
DataFrame frame = new DataFrame();
frame.setData(Util.hexToBytes("FF FF FF FF FF FF FF FF"));
frame.setStreamId(1);
frame.setEndOfStream(true);
byte[] data = parser.marshal(frame).createByteArray();
String hexFrame = Util.toHexString(data);
Assert.assertEquals(endStreamDataFrame(), hexFrame);
}
use of com.webpieces.http2.api.dto.lowlevel.DataFrame in project webpieces by deanhiller.
the class TestHttp2Data method testParseUnpaddedData.
@Test
public void testParseUnpaddedData() {
DataWrapper data = Util.hexToBytes(unpaddedDataFrame());
parser.parse(memento, data);
DataFrame frame = (DataFrame) assertGood();
Assert.assertEquals(1, frame.getStreamId());
Assert.assertEquals(8, frame.getData().getReadableSize());
Assert.assertEquals(0, frame.getPadding().getReadableSize());
Assert.assertTrue(frame.isEndOfStream());
}
use of com.webpieces.http2.api.dto.lowlevel.DataFrame in project webpieces by deanhiller.
the class TestHttp2Data method testMarshalDataFramePadded.
@Test
public void testMarshalDataFramePadded() {
DataFrame frame = new DataFrame();
frame.setData(Util.hexToBytes("FF FF FF FF FF FF FF FF"));
frame.setStreamId(1);
frame.setPadding(Util.hexToBytes("00 00"));
byte[] data = parser.marshal(frame).createByteArray();
String hexFrame = Util.toHexString(data);
Assert.assertEquals(paddedDataFrame(), hexFrame);
}
Aggregations