@Test public void readHeaderFrame() throws Http2Exception { final int streamId = 1; ByteBuf input = Unpooled.buffer(); try { Http2Headers headers = new DefaultHttp2Headers() .authority("foo") .method("get") .path("/") .scheme("https"); Http2Flags flags = new Http2Flags().endOfHeaders(true).endOfStream(true); writeHeaderFrame(input, streamId, headers, flags); frameReader.readFrame(ctx, input, listener); verify(listener).onHeadersRead(ctx, 1, headers, 0, true); } finally { input.release(); } }
@Override public void readFrame(ChannelHandlerContext ctx, ByteBuf input, Http2FrameListener listener) throws Http2Exception { if (readError) { input.skipBytes(input.readableBytes()); return; } try { do { if (readingHeaders) { processHeaderState(input); if (readingHeaders) { return; } } processPayloadState(ctx, input, listener); if (!readingHeaders) { return; } } while (input.isReadable()); } catch (Http2Exception e) { readError = !Http2Exception.isStreamError(e); throw e; } catch (RuntimeException e) { readError = true; throw e; } catch (Throwable cause) { readError = true; PlatformDependent.throwException(cause); } }
DefaultHttp2FrameReader implements Http2FrameReader, Http2FrameSizePolicy, Configuration { @Override public void readFrame(ChannelHandlerContext ctx, ByteBuf input, Http2FrameListener listener) throws Http2Exception { if (readError) { input.skipBytes(input.readableBytes()); return; } try { do { if (readingHeaders) { processHeaderState(input); if (readingHeaders) { return; } } processPayloadState(ctx, input, listener); if (!readingHeaders) { return; } } while (input.isReadable()); } catch (Http2Exception e) { readError = !Http2Exception.isStreamError(e); throw e; } catch (RuntimeException e) { readError = true; throw e; } catch (Throwable cause) { readError = true; PlatformDependent.throwException(cause); } } }
DefaultHttp2FrameReader implements Http2FrameReader, Http2FrameSizePolicy, Configuration { @Override public void readFrame(ChannelHandlerContext ctx, ByteBuf input, Http2FrameListener listener) throws Http2Exception { if (readError) { input.skipBytes(input.readableBytes()); return; } try { do { if (readingHeaders) { processHeaderState(input); if (readingHeaders) { return; } } processPayloadState(ctx, input, listener); if (!readingHeaders) { return; } } while (input.isReadable()); } catch (Http2Exception e) { readError = !Http2Exception.isStreamError(e); throw e; } catch (RuntimeException e) { readError = true; throw e; } catch (Throwable cause) { readError = true; PlatformDependent.throwException(cause); } } DefaultHttp2FrameReader();  DefaultHttp2FrameReader(boolean validateHeaders);  DefaultHttp2FrameReader(Http2HeadersDecoder headersDecoder); }
DefaultHttp2FrameReader implements Http2FrameReader, Http2FrameSizePolicy, Configuration { @Override public void readFrame(ChannelHandlerContext ctx, ByteBuf input, Http2FrameListener listener) throws Http2Exception { if (readError) { input.skipBytes(input.readableBytes()); return; } try { do { if (readingHeaders) { processHeaderState(input); if (readingHeaders) { return; } } processPayloadState(ctx, input, listener); if (!readingHeaders) { return; } } while (input.isReadable()); } catch (Http2Exception e) { readError = !Http2Exception.isStreamError(e); throw e; } catch (RuntimeException e) { readError = true; throw e; } catch (Throwable cause) { readError = true; PlatformDependent.throwException(cause); } } DefaultHttp2FrameReader();  DefaultHttp2FrameReader(boolean validateHeaders);  DefaultHttp2FrameReader(Http2HeadersDecoder headersDecoder); @Override Http2HeadersDecoder.Configuration headersConfiguration(); @Override Configuration configuration(); @Override Http2FrameSizePolicy frameSizePolicy(); @Override void maxFrameSize(int max); @Override int maxFrameSize(); @Override void close(); @Override void readFrame(ChannelHandlerContext ctx, ByteBuf input, Http2FrameListener listener); }
DefaultHttp2FrameReader implements Http2FrameReader, Http2FrameSizePolicy, Configuration { @Override public void readFrame(ChannelHandlerContext ctx, ByteBuf input, Http2FrameListener listener) throws Http2Exception { if (readError) { input.skipBytes(input.readableBytes()); return; } try { do { if (readingHeaders) { processHeaderState(input); if (readingHeaders) { return; } } processPayloadState(ctx, input, listener); if (!readingHeaders) { return; } } while (input.isReadable()); } catch (Http2Exception e) { readError = !Http2Exception.isStreamError(e); throw e; } catch (RuntimeException e) { readError = true; throw e; } catch (Throwable cause) { readError = true; PlatformDependent.throwException(cause); } } DefaultHttp2FrameReader();  DefaultHttp2FrameReader(boolean validateHeaders);  DefaultHttp2FrameReader(Http2HeadersDecoder headersDecoder); @Override Http2HeadersDecoder.Configuration headersConfiguration(); @Override Configuration configuration(); @Override Http2FrameSizePolicy frameSizePolicy(); @Override void maxFrameSize(int max); @Override int maxFrameSize(); @Override void close(); @Override void readFrame(ChannelHandlerContext ctx, ByteBuf input, Http2FrameListener listener);  }