Search in sources :

Example 11 with SettingsFrame

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

the class AbstractTest method sendAndAckSettingsFrame.

private void sendAndAckSettingsFrame(long max) throws InterruptedException, ExecutionException {
    //server's settings frame is finally coming in as well with maxConcurrent=1
    HeaderSettings settings = new HeaderSettings();
    settings.setMaxConcurrentStreams(max);
    mockChannel.write(HeaderSettings.createSettingsFrame(settings));
    //ack client frame
    mockChannel.write(new SettingsFrame(true));
    SettingsFrame ack = (SettingsFrame) mockChannel.getFrameAndClear();
    Assert.assertEquals(true, ack.isAck());
}
Also used : SettingsFrame(com.webpieces.http2parser.api.dto.SettingsFrame) HeaderSettings(com.webpieces.http2engine.impl.shared.data.HeaderSettings)

Example 12 with SettingsFrame

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

the class Level3IncomingSynchro method applyRemoteSettingsAndAck.

public CompletableFuture<Void> applyRemoteSettingsAndAck(SettingsFrame settings) {
    remoteSettings.applyRemoteSettings(settings);
    //now that settings is applied, ack the settings
    SettingsFrame settingsAck = new SettingsFrame(true);
    log.info("sending remote settings ack frame");
    return notifyListener.sendControlDataToSocket(settingsAck);
}
Also used : SettingsFrame(com.webpieces.http2parser.api.dto.SettingsFrame)

Example 13 with SettingsFrame

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

the class TestHttp2Settings method testParseSettings.

@Test
public void testParseSettings() {
    DataWrapper data = Util.hexToBytes(basicSettings());
    parser.parse(memento, data);
    SettingsFrame frame = (SettingsFrame) assertGood();
    Assert.assertEquals(0, frame.getStreamId());
    Assert.assertFalse(frame.isAck());
    Assert.assertEquals(frame.getSettings().size(), 2);
    Http2Setting setting = frame.getSettings().get(0);
    //first setting must be push from order in the bytes
    Assert.assertEquals(SettingsParameter.SETTINGS_ENABLE_PUSH, setting.getKnownName());
    Assert.assertEquals(1, setting.getValue());
}
Also used : DataWrapper(org.webpieces.data.api.DataWrapper) SettingsFrame(com.webpieces.http2parser.api.dto.SettingsFrame) Http2Setting(com.webpieces.http2parser.api.dto.lib.Http2Setting) Test(org.junit.Test)

Example 14 with SettingsFrame

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

the class TestHttp2Settings method testMarshalAck.

@Test
public void testMarshalAck() {
    SettingsFrame frame = new SettingsFrame();
    frame.setAck(true);
    byte[] data = parser.marshal(frame).createByteArray();
    String hexFrame = Util.toHexString(data);
    Assert.assertEquals(ackFrame(), hexFrame);
}
Also used : SettingsFrame(com.webpieces.http2parser.api.dto.SettingsFrame) Test(org.junit.Test)

Aggregations

SettingsFrame (com.webpieces.http2parser.api.dto.SettingsFrame)14 Test (org.junit.Test)8 HeaderSettings (com.webpieces.http2engine.impl.shared.data.HeaderSettings)5 Http2Setting (com.webpieces.http2parser.api.dto.lib.Http2Setting)5 Http2Msg (com.webpieces.http2parser.api.dto.lib.Http2Msg)4 DataWrapper (org.webpieces.data.api.DataWrapper)3 StreamWriter (com.webpieces.http2engine.api.StreamWriter)1 DataFrame (com.webpieces.http2parser.api.dto.DataFrame)1 ConnectionException (com.webpieces.http2parser.api.dto.error.ConnectionException)1 FrameHeaderData (com.webpieces.http2parser.impl.FrameHeaderData)1 ByteBuffer (java.nio.ByteBuffer)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 Preface (org.webpieces.http2client.mock.Preface)1 RequestsSent (org.webpieces.http2client.util.RequestsSent)1