// Path: src/main/java/com/twitter/http2/HttpCodecUtil.java
// static final int HTTP_CONNECTION_STREAM_ID = 0;
// 
// Path: src/main/java/com/twitter/http2/HttpCodecUtil.java
// static boolean isServerId(int streamId) {
//     // Server initiated streams have even stream identifiers
//     return streamId % 2 == 0;
// }


import static com.twitter.http2.HttpCodecUtil.isServerId;
import java.io.IOException;
import java.net.SocketAddress;
import java.nio.channels.ClosedChannelException;
import java.util.List;
import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelFuture;
import io.netty.channel.ChannelFutureListener;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelOutboundHandler;
import io.netty.channel.ChannelPromise;
import io.netty.handler.codec.ByteToMessageDecoder;
import io.netty.util.internal.EmptyArrays;
import static com.twitter.http2.HttpCodecUtil.HTTP_CONNECTION_STREAM_ID;
      if (connectionReceiveWindowSize < 0) {
          throw new IllegalArgumentException("connectionReceiveWindowSize");
      }
      // This will not send a window update frame immediately.
      // If this value increases the allowed receive window size,
      // a WINDOW_UPDATE frame will be sent when only half of the
      // session window size remains during data frame processing.
      // If this value decreases the allowed receive window size,
      // the window will be reduced as data frames are processed.
      initialConnectionReceiveWindowSize = connectionReceiveWindowSize;
    }

    @Override
    public void handlerAdded(ChannelHandlerContext ctx) throws Exception {
        super.handlerAdded(ctx);
        context = ctx;
    }

    @Override
    protected void decode(ChannelHandlerContext ctx, ByteBuf in, List<Object> out) throws Exception {
        httpFrameDecoder.decode(in);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public void readDataFramePadding(int streamId, boolean endStream, int padding) {
        int deltaWindowSize = -1 * padding;
        int newConnectionWindowSize = httpConnection.updateReceiveWindowSize(
// Path: src/main/java/com/twitter/http2/HttpCodecUtil.java
// static final int HTTP_CONNECTION_STREAM_ID = 0;
// 
// Path: src/main/java/com/twitter/http2/HttpCodecUtil.java
// static boolean isServerId(int streamId) {
//     // Server initiated streams have even stream identifiers
//     return streamId % 2 == 0;
// }


// Path: src/main/java/com/twitter/http2/HttpConnectionHandler.java
import static com.twitter.http2.HttpCodecUtil.isServerId;
import java.io.IOException;
import java.net.SocketAddress;
import java.nio.channels.ClosedChannelException;
import java.util.List;
import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelFuture;
import io.netty.channel.ChannelFutureListener;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelOutboundHandler;
import io.netty.channel.ChannelPromise;
import io.netty.handler.codec.ByteToMessageDecoder;
import io.netty.util.internal.EmptyArrays;
import static com.twitter.http2.HttpCodecUtil.HTTP_CONNECTION_STREAM_ID;

      if (connectionReceiveWindowSize < 0) {
          throw new IllegalArgumentException("connectionReceiveWindowSize");
      }
      // This will not send a window update frame immediately.
      // If this value increases the allowed receive window size,
      // a WINDOW_UPDATE frame will be sent when only half of the
      // session window size remains during data frame processing.
      // If this value decreases the allowed receive window size,
      // the window will be reduced as data frames are processed.
      initialConnectionReceiveWindowSize = connectionReceiveWindowSize;
    }

    @Override
    public void handlerAdded(ChannelHandlerContext ctx) throws Exception {
        super.handlerAdded(ctx);
        context = ctx;
    }

    @Override
    protected void decode(ChannelHandlerContext ctx, ByteBuf in, List<Object> out) throws Exception {
        httpFrameDecoder.decode(in);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public void readDataFramePadding(int streamId, boolean endStream, int padding) {
        int deltaWindowSize = -1 * padding;
        int newConnectionWindowSize = httpConnection.updateReceiveWindowSize(
                HTTP_CONNECTION_STREAM_ID, deltaWindowSize);