class Http2ConnectionHandler extends ByteToMessageDecoder implements Http2LifecycleManager, ChannelOutboundHandler {

  public void onHttpClientUpgrade() throws Http2Exception {
    if (connection().isServer()) {
      throw Http2Exception.connectionError(
          Http2Error.PROTOCOL_ERROR, "Client-side HTTP upgrade requested for a server");
    }
    if (!prefaceSent()) {
      // If the preface was not sent yet it most likely means the handler was not added to the
      // pipeline before
      // calling this method.
      throw Http2Exception.connectionError(
          Http2Error.INTERNAL_ERROR, "HTTP upgrade must occur after preface was sent");
    }
    if (decoder.prefaceReceived()) {
      throw Http2Exception.connectionError(
          Http2Error.PROTOCOL_ERROR, "HTTP upgrade must occur before HTTP/2 preface is received");
    }

    // Create a local stream used for the HTTP cleartext upgrade.
    connection().local().createStream(Http2CodecUtil.HTTP_UPGRADE_STREAM_ID, true);
  }

  protected  Http2ConnectionHandler(
      final Http2ConnectionDecoder decoder,
      final Http2ConnectionEncoder encoder,
      final Http2Settings initialSettings);
  protected  Http2ConnectionHandler(
      final Http2ConnectionDecoder decoder,
      final Http2ConnectionEncoder encoder,
      final Http2Settings initialSettings,
      final boolean decoupleCloseAndGoAway);

}