Search in sources :

Example 26 with DataFrame

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;
}
Also used : DataFrame(com.webpieces.http2.api.dto.lowlevel.DataFrame)

Example 27 with DataFrame

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());
}
Also used : DataWrapper(org.webpieces.data.api.DataWrapper) DataFrame(com.webpieces.http2.api.dto.lowlevel.DataFrame) Test(org.junit.Test)

Example 28 with DataFrame

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);
}
Also used : DataFrame(com.webpieces.http2.api.dto.lowlevel.DataFrame) Test(org.junit.Test)

Example 29 with DataFrame

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());
}
Also used : DataWrapper(org.webpieces.data.api.DataWrapper) DataFrame(com.webpieces.http2.api.dto.lowlevel.DataFrame) Test(org.junit.Test)

Example 30 with DataFrame

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);
}
Also used : DataFrame(com.webpieces.http2.api.dto.lowlevel.DataFrame) Test(org.junit.Test)

Aggregations

DataFrame (com.webpieces.http2.api.dto.lowlevel.DataFrame)52 Test (org.junit.Test)31 DataWrapper (org.webpieces.data.api.DataWrapper)28 StreamWriter (com.webpieces.http2.api.streaming.StreamWriter)19 Http2Request (com.webpieces.http2.api.dto.highlevel.Http2Request)13 Http2Response (com.webpieces.http2.api.dto.highlevel.Http2Response)11 MockResponseListener (org.webpieces.http2client.mock.MockResponseListener)9 PassedIn (org.webpieces.httpfrontend2.api.mock2.MockHttp2RequestListener.PassedIn)9 GoAwayFrame (com.webpieces.http2.api.dto.lowlevel.GoAwayFrame)8 Http2Msg (com.webpieces.http2.api.dto.lowlevel.lib.Http2Msg)8 MockStreamWriter (org.webpieces.http2client.mock.MockStreamWriter)7 StreamRef (com.webpieces.http2.api.streaming.StreamRef)6 HttpRequest (org.webpieces.httpparser.api.dto.HttpRequest)6 ConnectionClosedException (com.webpieces.http2engine.api.error.ConnectionClosedException)5 Header (org.webpieces.httpparser.api.common.Header)5 Http2Headers (com.webpieces.http2.api.dto.highlevel.Http2Headers)4 HttpData (org.webpieces.httpparser.api.dto.HttpData)4 HttpResponse (org.webpieces.httpparser.api.dto.HttpResponse)4 ConnectionException (com.webpieces.http2.api.dto.error.ConnectionException)3 Http2Push (com.webpieces.http2.api.dto.highlevel.Http2Push)3