class DefaultHttp2FrameReader implements Http2FrameReader, Http2FrameSizePolicy, Configuration {

  private void readSettingsFrame(
      final ChannelHandlerContext ctx, final ByteBuf payload, final Http2FrameListener listener)
      throws Http2Exception {
    if (flags.ack()) {
      listener.onSettingsAckRead(ctx);
    } else {
      final int numSettings = payloadLength / SETTING_ENTRY_LENGTH;
      final Http2Settings settings = new Http2Settings();
      for (int index = 0; index < numSettings; ++index) {
        final char id = (char) payload.readUnsignedShort();
        final long value = payload.readUnsignedInt();
        try {
          settings.put(id, Long.valueOf(value));
        } catch (final IllegalArgumentException e) {
          switch (id) {
            case SETTINGS_MAX_FRAME_SIZE:
              throw connectionError(PROTOCOL_ERROR, e, e.getMessage());
            case SETTINGS_INITIAL_WINDOW_SIZE:
              throw connectionError(FLOW_CONTROL_ERROR, e, e.getMessage());
            default:
              throw connectionError(PROTOCOL_ERROR, e, e.getMessage());
          }
        }
      }
      listener.onSettingsRead(ctx, settings);
    }
  }

  public  DefaultHttp2FrameReader();
  public  DefaultHttp2FrameReader(final boolean validateHeaders);
  public  DefaultHttp2FrameReader(final Http2HeadersDecoder headersDecoder);

}