protected HttpUriRequest prepareRequest(final BufferedBulk clientRequest) throws IOException { String requestURL = getRequestURL(getNextServer(), clientRequest.getURI()); HttpUriRequest httpUriRequest = new HttpPost(requestURL); ByteBuf byteBuf = clientRequest.serializeRequest(); ByteBufEntityBuilder entityBuilder = (ByteBufEntityBuilder) new ByteBufEntityBuilder() .setByteBuf(byteBuf) .setContentLength(byteBuf.writerIndex()) .setContentType(requestContentType); ((HttpEntityEnclosingRequest) httpUriRequest).setEntity(entityBuilder.build()); return httpUriRequest; }
@Override public HttpEntity build() { return new ByteBufHttpEntity(byteByf, contentLength, getContentType()); }