code: public static void setTransferEncodingChunked(HttpMessage m, boolean chunked) {
          if (chunked) {
              m.headers().set(HttpHeaderNames.TRANSFER_ENCODING, HttpHeaderValues.CHUNKED);
              m.headers().remove(HttpHeaderNames.CONTENT_LENGTH);
          } else {
              List<String> encodings = m.headers().getAll(HttpHeaderNames.TRANSFER_ENCODING);
              if (encodings.isEmpty()) {
                  return;
              }
              List<CharSequence> values = new ArrayList<CharSequence>(encodings);
              Iterator<CharSequence> valuesIt = values.iterator();
              while (valuesIt.hasNext()) {
                  CharSequence value = valuesIt.next();
                  if (HttpHeaderValues.CHUNKED.contentEqualsIgnoreCase(value)) {
                      valuesIt.remove();
                  }
              }
              if (values.isEmpty()) {
                  m.headers().remove(HttpHeaderNames.TRANSFER_ENCODING);
              } else {
                  m.headers().set(HttpHeaderNames.TRANSFER_ENCODING, values);
              }
          }
      }
docs: Set the {@link HttpHeaderNames#TRANSFER_ENCODING} to either include {@link HttpHeaderValues#CHUNKED} if
  {@code chunked} is {@code true}, or remove {@link HttpHeaderValues#CHUNKED} if {@code chunked} is {@code false}.
  
  @param m The message which contains the headers to modify.
  @param chunked if {@code true} then include {@link HttpHeaderValues#CHUNKED} in the headers. otherwise remove
  {@link HttpHeaderValues#CHUNKED} from the headers.