Search in sources :

Example 1 with HeaderEncoding

use of com.webpieces.hpack.impl.HeaderEncoding 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.hpack.api.dto.Http2Response) HeaderEncoding(com.webpieces.hpack.impl.HeaderEncoding) Encoder(com.twitter.hpack.Encoder) Http2Header(com.webpieces.http2parser.api.dto.lib.Http2Header) ArrayList(java.util.ArrayList) Http2Frame(com.webpieces.http2parser.api.dto.lib.Http2Frame)

Example 2 with HeaderEncoding

use of com.webpieces.hpack.impl.HeaderEncoding 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.hpack.api.dto.Http2Response) HeaderEncoding(com.webpieces.hpack.impl.HeaderEncoding) Encoder(com.twitter.hpack.Encoder) Http2Header(com.webpieces.http2parser.api.dto.lib.Http2Header) ArrayList(java.util.ArrayList) Http2Frame(com.webpieces.http2parser.api.dto.lib.Http2Frame)

Aggregations

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