Search in sources :

Example 1 with Story

use of okhttp3.internal.http2.hpackjson.Story in project okhttp by square.

the class HpackRoundTripTest method testRoundTrip.

@ParameterizedTest
@ArgumentsSource(StoriesTestProvider.class)
public void testRoundTrip(Story story) throws Exception {
    Assumptions.assumeFalse(story == Story.MISSING, "Test stories missing, checkout git submodule");
    Story story2 = story.clone();
    // Mutate cases in base class.
    for (Case caze : story2.getCases()) {
        hpackWriter.writeHeaders(caze.getHeaders());
        caze.setWire(bytesOut.readByteString());
    }
    testDecoder(story2);
}
Also used : Story(okhttp3.internal.http2.hpackjson.Story) Case(okhttp3.internal.http2.hpackjson.Case) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) ArgumentsSource(org.junit.jupiter.params.provider.ArgumentsSource)

Example 2 with Story

use of okhttp3.internal.http2.hpackjson.Story in project okhttp by square.

the class HpackRoundTripTest method testRoundTrip.

@Test
public void testRoundTrip() throws Exception {
    Story story = getStory().clone();
    // Mutate cases in base class.
    for (Case caze : story.getCases()) {
        hpackWriter.writeHeaders(caze.getHeaders());
        caze.setWire(bytesOut.readByteString());
    }
    testDecoder(story);
}
Also used : Story(okhttp3.internal.http2.hpackjson.Story) Case(okhttp3.internal.http2.hpackjson.Case) Test(org.junit.Test)

Example 3 with Story

use of okhttp3.internal.http2.hpackjson.Story in project okhttp by square.

the class HpackDecodeTestBase method testDecoder.

protected void testDecoder(Story story) throws Exception {
    for (Case testCase : story.getCases()) {
        bytesIn.write(testCase.getWire());
        hpackReader.readHeaders();
        assertSetEquals(String.format("seqno=%d", testCase.getSeqno()), testCase.getHeaders(), hpackReader.getAndResetHeaderList());
    }
}
Also used : Case(okhttp3.internal.http2.hpackjson.Case)

Aggregations

Case (okhttp3.internal.http2.hpackjson.Case)3 Story (okhttp3.internal.http2.hpackjson.Story)2 Test (org.junit.Test)1 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)1 ArgumentsSource (org.junit.jupiter.params.provider.ArgumentsSource)1