code: @Override
      protected void encode(ChannelHandlerContext ctx, HttpObject obj, List<Object> out) throws Exception {
          // 100-continue is typically a FullHttpResponse, but the decoded
          // Http2HeadersFrame should not be marked as endStream=true
          if (obj instanceof HttpResponse) {
              final HttpResponse res = (HttpResponse) obj;
              if (res.status().equals(HttpResponseStatus.CONTINUE)) {
                  if (res instanceof FullHttpResponse) {
                      final Http2Headers headers = toHttp2Headers(ctx, res);
                      out.add(new DefaultHttp2HeadersFrame(headers, false));
                      return;
                  } else {
                      throw new EncoderException(
                              HttpResponseStatus.CONTINUE.toString() + " must be a FullHttpResponse");
                  }
              }
          }
  
          if (obj instanceof HttpMessage) {
              Http2Headers headers = toHttp2Headers(ctx, (HttpMessage) obj);
              boolean noMoreFrames = false;
              if (obj instanceof FullHttpMessage) {
                  FullHttpMessage full = (FullHttpMessage) obj;
                  noMoreFrames = !full.content().isReadable() && full.trailingHeaders().isEmpty();
              }
  
              out.add(new DefaultHttp2HeadersFrame(headers, noMoreFrames));
          }
  
          if (obj instanceof LastHttpContent) {
              LastHttpContent last = (LastHttpContent) obj;
              encodeLastContent(last, out);
          } else if (obj instanceof HttpContent) {
              HttpContent cont = (HttpContent) obj;
              out.add(new DefaultHttp2DataFrame(cont.content().retain(), false));
          }
      }
docs: Encode from an {@link HttpObject} to an {@link Http2StreamFrame}. This method will
  be called for each written message that can be handled by this encoder.
  
  NOTE: 100-Continue responses that are NOT {@link FullHttpResponse} will be rejected.
  
  @param ctx           the {@link ChannelHandlerContext} which this handler belongs to
  @param obj           the {@link HttpObject} message to encode
  @param out           the {@link List} into which the encoded msg should be added
  needs to do some kind of aggregation
  @throws Exception    is thrown if an error occurs