code: @Override
    public HttpRequest convertRequest(Envelope request) {
      ByteBuf requestBuffer = Unpooled.buffer(request.getSerializedSize());
      try {
        OutputStream outputStream = new ByteBufOutputStream(requestBuffer);
        request.writeTo(outputStream);
        outputStream.flush();
      } catch (IOException e) {
        // deliberately ignored, as the underlying operation doesn't involve I/O
      }
  
      String host = ((InetSocketAddress) channel().remoteAddress()).getAddress().getHostAddress();
      String uriPath = String.format("%s%s/%s", path, request.getService(), request.getMethod());
  
      FullHttpRequest httpRequest = new DefaultFullHttpRequest(HttpVersion.HTTP_1_1,
          HttpMethod.POST, new QueryStringEncoder(uriPath).toString(), requestBuffer);
      httpRequest.headers().set(HttpHeaders.Names.HOST, host);
      httpRequest.headers().set(HttpHeaders.Names.CONNECTION, HttpHeaders.Values.KEEP_ALIVE);
      httpRequest.headers().set(HttpHeaders.Names.CONTENT_LENGTH, requestBuffer.readableBytes());
      httpRequest.headers().set(HttpHeaders.Names.CONTENT_TYPE, QuartzProtocol.CONTENT_TYPE);
      return httpRequest;
    }
docs: {@inheritDoc}