Search in sources :

Example 1 with HpackConfig

use of com.webpieces.hpack.api.HpackConfig in project webpieces by deanhiller.

the class TestSplitHeaders method setup.

@Before
public void setup() {
    HpackConfig config = new HpackConfig("myhpack");
    config.setLocalMaxFrameSize(50);
    config.setRemoteMaxFrameSize(50);
    parser = HpackParserFactory.createStatefulParser(new TwoPools("pl", new SimpleMeterRegistry()), config);
}
Also used : HpackConfig(com.webpieces.hpack.api.HpackConfig) TwoPools(org.webpieces.data.api.TwoPools) SimpleMeterRegistry(io.micrometer.core.instrument.simple.SimpleMeterRegistry) Before(org.junit.Before)

Example 2 with HpackConfig

use of com.webpieces.hpack.api.HpackConfig in project webpieces by deanhiller.

the class TestBackpressure method create4BuffersWith3Messags.

private List<ByteBuffer> create4BuffersWith3Messags() {
    HpackStatefulParser parser = HpackParserFactory.createStatefulParser(new TwoPools("pl", new SimpleMeterRegistry()), new HpackConfig("tests"));
    Http2Response response1 = Requests.createResponse(1);
    DataFrame response2 = Requests.createBigData(1, false);
    DataFrame response3 = Requests.createBigData(1, true);
    DataWrapper buf1 = parser.marshal(response1);
    DataWrapper buf2 = parser.marshal(response2);
    DataWrapper buf3 = parser.marshal(response3);
    // one big wrapper that we can slice up..
    DataWrapper all = DATA_GEN.chainDataWrappers(buf1, buf2, buf3);
    byte[] part1 = all.readBytesAt(0, 10);
    byte[] part2 = all.readBytesAt(10, buf1.getReadableSize());
    byte[] part3 = all.readBytesAt(10 + buf1.getReadableSize(), buf2.getReadableSize());
    int offset = 10 + buf1.getReadableSize() + buf2.getReadableSize();
    int remaining = all.getReadableSize() - offset;
    byte[] part4 = all.readBytesAt(offset, remaining);
    List<ByteBuffer> buffers = new ArrayList<>();
    buffers.add(ByteBuffer.wrap(part1));
    buffers.add(ByteBuffer.wrap(part2));
    buffers.add(ByteBuffer.wrap(part3));
    buffers.add(ByteBuffer.wrap(part4));
    return buffers;
}
Also used : DataWrapper(org.webpieces.data.api.DataWrapper) Http2Response(com.webpieces.http2.api.dto.highlevel.Http2Response) HpackStatefulParser(com.webpieces.hpack.api.HpackStatefulParser) TwoPools(org.webpieces.data.api.TwoPools) HpackConfig(com.webpieces.hpack.api.HpackConfig) SimpleMeterRegistry(io.micrometer.core.instrument.simple.SimpleMeterRegistry) ArrayList(java.util.ArrayList) DataFrame(com.webpieces.http2.api.dto.lowlevel.DataFrame) ByteBuffer(java.nio.ByteBuffer)

Aggregations

HpackConfig (com.webpieces.hpack.api.HpackConfig)2 SimpleMeterRegistry (io.micrometer.core.instrument.simple.SimpleMeterRegistry)2 TwoPools (org.webpieces.data.api.TwoPools)2 HpackStatefulParser (com.webpieces.hpack.api.HpackStatefulParser)1 Http2Response (com.webpieces.http2.api.dto.highlevel.Http2Response)1 DataFrame (com.webpieces.http2.api.dto.lowlevel.DataFrame)1 ByteBuffer (java.nio.ByteBuffer)1 ArrayList (java.util.ArrayList)1 Before (org.junit.Before)1 DataWrapper (org.webpieces.data.api.DataWrapper)1