Search in sources :

Example 1 with HeaderSettings

use of com.webpieces.http2engine.impl.shared.data.HeaderSettings in project webpieces by deanhiller.

the class Requests method createSomeSettings.

public static HeaderSettings createSomeSettings() {
    HeaderSettings settings = new HeaderSettings();
    settings.setHeaderTableSize(4099);
    settings.setInitialWindowSize(5009);
    settings.setMaxConcurrentStreams(1L);
    settings.setMaxFrameSize(16385);
    settings.setMaxHeaderListSize(5222);
    settings.setPushEnabled(true);
    return settings;
}
Also used : HeaderSettings(com.webpieces.http2engine.impl.shared.data.HeaderSettings)

Example 2 with HeaderSettings

use of com.webpieces.http2engine.impl.shared.data.HeaderSettings in project webpieces by deanhiller.

the class AbstractHttp2Test method simulateClientSendingPrefaceAndSettings.

protected void simulateClientSendingPrefaceAndSettings() {
    //this method is overloaded by one test
    HeaderSettings settings = Http2Requests.createSomeSettings();
    mockChannel.sendPrefaceAndSettings(HeaderSettings.createSettingsFrame(settings));
    List<Http2Msg> frames = mockChannel.getFramesAndClear();
    Assert.assertEquals(2, frames.size());
}
Also used : HeaderSettings(com.webpieces.http2engine.impl.shared.data.HeaderSettings) Http2Msg(com.webpieces.http2parser.api.dto.lib.Http2Msg)

Example 3 with HeaderSettings

use of com.webpieces.http2engine.impl.shared.data.HeaderSettings in project webpieces by deanhiller.

the class TestS3InitialHttpConnections method testSection3_4WithH2cTokenPriorKnowledge.

/**
	 * Only will work with webpieces and 'jetty with alpn installed'
	 * 
	 * should send PRI * HTTP/2.0\r\n\r\nSM\r\n\r\n
	 * and server sends back it's preface...
	 * The server connection preface consists of a potentially empty SETTINGS 
	 * frame (Section 6.5) that MUST be the first frame the server sends in the HTTP/2 connection.
	 * 
	 * SettingsFrame{streamId=0, ack=false, settings=[{SETTINGS_HEADER_TABLE_SIZE: 4096}, {SETTINGS_MAX_CONCURRENT_STREAMS: 1024}, {SETTINGS_INITIAL_WINDOW_SIZE: 65535}, {SETTINGS_MAX_HEADER_LIST_SIZE: 8192}]} 
	 * SettingsFrame{streamId=0, ack=true, settings=[]} 
	 */
@Test
public void testSection3_4WithH2cTokenPriorKnowledge() {
    HeaderSettings settings = Http2Requests.createSomeSettings();
    mockChannel.sendPrefaceAndSettings(HeaderSettings.createSettingsFrame(settings));
    List<Http2Msg> frames = mockChannel.getFramesAndClear();
    Assert.assertEquals(2, frames.size());
    SettingsFrame serverSettings = (SettingsFrame) frames.get(0);
    Assert.assertFalse(serverSettings.isAck());
    SettingsFrame ackClientSettings = (SettingsFrame) frames.get(1);
    Assert.assertTrue(ackClientSettings.isAck());
}
Also used : SettingsFrame(com.webpieces.http2parser.api.dto.SettingsFrame) HeaderSettings(com.webpieces.http2engine.impl.shared.data.HeaderSettings) Http2Msg(com.webpieces.http2parser.api.dto.lib.Http2Msg) Test(org.junit.Test)

Example 4 with HeaderSettings

use of com.webpieces.http2engine.impl.shared.data.HeaderSettings in project webpieces by deanhiller.

the class Http2Requests method createSomeSettings.

public static HeaderSettings createSomeSettings() {
    HeaderSettings settings = new HeaderSettings();
    settings.setHeaderTableSize(4099);
    settings.setInitialWindowSize(5009);
    settings.setMaxConcurrentStreams(1L);
    settings.setMaxFrameSize(16385);
    settings.setMaxHeaderListSize(5222);
    settings.setPushEnabled(true);
    return settings;
}
Also used : HeaderSettings(com.webpieces.http2engine.impl.shared.data.HeaderSettings)

Example 5 with HeaderSettings

use of com.webpieces.http2engine.impl.shared.data.HeaderSettings in project webpieces by deanhiller.

the class TestSMaxConcurrentSetting method testSend2ndPushHeadersOnlyOnAfterSettingsFrameMaxConcurrentBigger.

@Test
public void testSend2ndPushHeadersOnlyOnAfterSettingsFrameMaxConcurrentBigger() throws InterruptedException, ExecutionException, TimeoutException {
    WriterHolder sent = sendTwoRequests();
    //client increases max concurrent
    HeaderSettings settings = new HeaderSettings();
    settings.setMaxConcurrentStreams(2L);
    mockChannel.send(HeaderSettings.createSettingsFrame(settings));
    List<Http2Msg> frames = mockChannel.getFramesAndClear();
    Assert.assertEquals(2, frames.size());
    Assert.assertEquals(sent.getResp2(), frames.get(0));
    SettingsFrame dataRecv1 = (SettingsFrame) frames.get(1);
    Assert.assertTrue(dataRecv1.isAck());
    StreamWriter writer2 = sent.getFuture2().get(2, TimeUnit.SECONDS);
    DataFrame data2 = Http2Requests.createData1(sent.getResp2().getStreamId(), true);
    writer2.processPiece(data2);
    DataFrame dataRecv2 = (DataFrame) mockChannel.getFrameAndClear();
    Assert.assertEquals(sent.getResp2().getStreamId(), dataRecv2.getStreamId());
}
Also used : SettingsFrame(com.webpieces.http2parser.api.dto.SettingsFrame) HeaderSettings(com.webpieces.http2engine.impl.shared.data.HeaderSettings) StreamWriter(com.webpieces.http2engine.api.StreamWriter) DataFrame(com.webpieces.http2parser.api.dto.DataFrame) Http2Msg(com.webpieces.http2parser.api.dto.lib.Http2Msg) Test(org.junit.Test)

Aggregations

HeaderSettings (com.webpieces.http2engine.impl.shared.data.HeaderSettings)9 SettingsFrame (com.webpieces.http2parser.api.dto.SettingsFrame)5 Http2Msg (com.webpieces.http2parser.api.dto.lib.Http2Msg)5 Test (org.junit.Test)5 StreamWriter (com.webpieces.http2engine.api.StreamWriter)1 DataFrame (com.webpieces.http2parser.api.dto.DataFrame)1 GoAwayFrame (com.webpieces.http2parser.api.dto.GoAwayFrame)1 DataWrapper (org.webpieces.data.api.DataWrapper)1 Preface (org.webpieces.http2client.mock.Preface)1 RequestsSent (org.webpieces.http2client.util.RequestsSent)1