Search in sources :

Example 46 with DataWrapper

use of org.webpieces.data.api.DataWrapper in project webpieces by deanhiller.

the class TestHttp2Priority method testParsePriorityFrame.

@Test
public void testParsePriorityFrame() {
    DataWrapper data = Util.hexToBytes(priorityFrame());
    parser.parse(memento, data);
    PriorityFrame frame = (PriorityFrame) assertGood();
    Assert.assertEquals(1, frame.getStreamId());
    PriorityDetails details = frame.getPriorityDetails();
    Assert.assertTrue(details.isStreamDependencyIsExclusive());
    Assert.assertEquals(5, 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)

Example 47 with DataWrapper

use of org.webpieces.data.api.DataWrapper in project webpieces by deanhiller.

the class TestHttp2Settings method testParseAck.

@Test
public void testParseAck() {
    DataWrapper data = Util.hexToBytes(ackFrame());
    parser.parse(memento, data);
    SettingsFrame frame = (SettingsFrame) assertGood();
    Assert.assertEquals(0, frame.getStreamId());
    Assert.assertTrue(frame.isAck());
    Assert.assertEquals(frame.getSettings().size(), 0);
}
Also used : DataWrapper(org.webpieces.data.api.DataWrapper) SettingsFrame(com.webpieces.http2parser.api.dto.SettingsFrame) Test(org.junit.Test)

Example 48 with DataWrapper

use of org.webpieces.data.api.DataWrapper in project webpieces by deanhiller.

the class TestHttp2Ping method testParsePongFrame.

@Test
public void testParsePongFrame() {
    DataWrapper data = Util.hexToBytes(getPongFrame());
    parser.parse(memento, data);
    PingFrame frame = (PingFrame) assertGood();
    Assert.assertEquals(0, frame.getStreamId());
    Assert.assertTrue(frame.isPingResponse());
}
Also used : DataWrapper(org.webpieces.data.api.DataWrapper) PingFrame(com.webpieces.http2parser.api.dto.PingFrame) Test(org.junit.Test)

Example 49 with DataWrapper

use of org.webpieces.data.api.DataWrapper in project webpieces by deanhiller.

the class TestHttp2Ping method testParsePingFrame.

@Test
public void testParsePingFrame() {
    DataWrapper data = Util.hexToBytes(getPingFrame());
    parser.parse(memento, data);
    PingFrame frame = (PingFrame) assertGood();
    Assert.assertEquals(0, frame.getStreamId());
    Assert.assertFalse(frame.isPingResponse());
}
Also used : DataWrapper(org.webpieces.data.api.DataWrapper) PingFrame(com.webpieces.http2parser.api.dto.PingFrame) Test(org.junit.Test)

Example 50 with DataWrapper

use of org.webpieces.data.api.DataWrapper in project webpieces by deanhiller.

the class TestHttp2Data method testParseEndOfStreamTrue.

@Test
public void testParseEndOfStreamTrue() {
    DataWrapper data = Util.hexToBytes(endStreamDataFrame());
    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.http2parser.api.dto.DataFrame) Test(org.junit.Test)

Aggregations

DataWrapper (org.webpieces.data.api.DataWrapper)115 Test (org.junit.Test)47 DataFrame (com.webpieces.http2parser.api.dto.DataFrame)22 ByteBuffer (java.nio.ByteBuffer)20 GoAwayFrame (com.webpieces.http2parser.api.dto.GoAwayFrame)18 Header (org.webpieces.httpparser.api.common.Header)17 HttpPayload (org.webpieces.httpparser.api.dto.HttpPayload)17 HttpRequest (org.webpieces.httpparser.api.dto.HttpRequest)16 HttpData (org.webpieces.httpparser.api.dto.HttpData)15 HttpResponse (org.webpieces.httpparser.api.dto.HttpResponse)12 Http2Request (com.webpieces.hpack.api.dto.Http2Request)10 StreamWriter (com.webpieces.http2engine.api.StreamWriter)8 PassedIn (org.webpieces.httpfrontend2.api.mock2.MockHttp2RequestListener.PassedIn)8 MockResponseListener (org.webpieces.http2client.mock.MockResponseListener)7 HttpChunk (org.webpieces.httpparser.api.dto.HttpChunk)7 Http2Response (com.webpieces.hpack.api.dto.Http2Response)6 ConnectionClosedException (com.webpieces.http2engine.api.ConnectionClosedException)6 ArrayList (java.util.ArrayList)6 ShutdownStream (com.webpieces.http2engine.api.error.ShutdownStream)5 ConnectionException (com.webpieces.http2parser.api.dto.error.ConnectionException)5