Search in sources :

Example 1 with Encoder

use of com.twitter.hpack.Encoder in project webpieces by deanhiller.

the class TestS4FrameSizeAndHeaders method createInterleavedFrames.

private List<Http2Frame> createInterleavedFrames() {
    Http2Response response1 = new Http2Response();
    response1.setStreamId(1);
    response1.setEndOfStream(true);
    fillHeaders(response1);
    HeaderEncoding encoding = new HeaderEncoding();
    List<Http2Frame> frames1 = encoding.translateToFrames(localSettings.getMaxFrameSize(), new Encoder(localSettings.getHeaderTableSize()), response1);
    Http2Response response2 = new Http2Response();
    response2.setStreamId(3);
    response1.setEndOfStream(true);
    response2.addHeader(new Http2Header(Http2HeaderName.ACCEPT, "value"));
    List<Http2Frame> frames2 = encoding.translateToFrames(localSettings.getMaxFrameSize(), new Encoder(localSettings.getHeaderTableSize()), response2);
    List<Http2Frame> frames = new ArrayList<>();
    frames.addAll(frames1);
    frames.add(1, frames2.get(0));
    return frames;
}
Also used : Http2Response(com.webpieces.http2.api.dto.highlevel.Http2Response) HeaderEncoding(com.webpieces.hpack.impl.HeaderEncoding) Encoder(com.twitter.hpack.Encoder) Http2Header(com.webpieces.http2.api.dto.lowlevel.lib.Http2Header) ArrayList(java.util.ArrayList) Http2Frame(com.webpieces.http2.api.dto.lowlevel.lib.Http2Frame)

Example 2 with Encoder

use of com.twitter.hpack.Encoder in project webpieces by deanhiller.

the class TestC4FrameSizeAndHeaders method createInterleavedFrames.

private List<Http2Frame> createInterleavedFrames() {
    Http2Response response1 = new Http2Response();
    response1.setStreamId(1);
    response1.setEndOfStream(true);
    fillHeaders(response1);
    HeaderEncoding encoding = new HeaderEncoding();
    List<Http2Frame> frames1 = encoding.translateToFrames(localSettings.getMaxFrameSize(), new Encoder(localSettings.getHeaderTableSize()), response1);
    Http2Response response2 = new Http2Response();
    response2.setStreamId(3);
    response1.setEndOfStream(true);
    response2.addHeader(new Http2Header(Http2HeaderName.ACCEPT, "value"));
    List<Http2Frame> frames2 = encoding.translateToFrames(localSettings.getMaxFrameSize(), new Encoder(localSettings.getHeaderTableSize()), response2);
    List<Http2Frame> frames = new ArrayList<>();
    frames.addAll(frames1);
    frames.add(1, frames2.get(0));
    return frames;
}
Also used : Http2Response(com.webpieces.http2.api.dto.highlevel.Http2Response) HeaderEncoding(com.webpieces.hpack.impl.HeaderEncoding) Encoder(com.twitter.hpack.Encoder) Http2Header(com.webpieces.http2.api.dto.lowlevel.lib.Http2Header) ArrayList(java.util.ArrayList) Http2Frame(com.webpieces.http2.api.dto.lowlevel.lib.Http2Frame)

Example 3 with Encoder

use of com.twitter.hpack.Encoder in project webpieces by deanhiller.

the class HpackParserImpl method createHeadersData.

private DataWrapper createHeadersData(MarshalStateImpl state, Http2Headers headers) {
    long maxFrameSize = state.getMaxRemoteFrameSize();
    Encoder encoder = state.getEncoder();
    List<Http2Frame> headerFrames = encoding.translateToFrames(maxFrameSize, encoder, headers);
    return translate(headerFrames);
}
Also used : Encoder(com.twitter.hpack.Encoder) Http2Frame(com.webpieces.http2.api.dto.lowlevel.lib.Http2Frame)

Example 4 with Encoder

use of com.twitter.hpack.Encoder in project webpieces by deanhiller.

the class HpackParserImpl method createPushPromiseData.

private DataWrapper createPushPromiseData(MarshalStateImpl state, Http2Push p) {
    long maxFrameSize = state.getMaxRemoteFrameSize();
    Encoder encoder = state.getEncoder();
    List<Http2Frame> headerFrames = encoding.translateToFrames(maxFrameSize, encoder, p);
    return translate(headerFrames);
}
Also used : Encoder(com.twitter.hpack.Encoder) Http2Frame(com.webpieces.http2.api.dto.lowlevel.lib.Http2Frame)

Aggregations

Encoder (com.twitter.hpack.Encoder)4 Http2Frame (com.webpieces.http2.api.dto.lowlevel.lib.Http2Frame)4 HeaderEncoding (com.webpieces.hpack.impl.HeaderEncoding)2 Http2Response (com.webpieces.http2.api.dto.highlevel.Http2Response)2 Http2Header (com.webpieces.http2.api.dto.lowlevel.lib.Http2Header)2 ArrayList (java.util.ArrayList)2