/**
   * Compute content encoding
   *
   * @param sampler {@link HTTPSamplerBase}
   * @param request {@link HttpRequestHdr}
   * @param pageEncodings Map<String, String>
   * @param formEncodings Map<String, String>
   * @throws MalformedURLException
   */
  protected void computeContentEncoding(
      HTTPSamplerBase sampler,
      HttpRequestHdr request,
      Map<String, String> pageEncodings,
      Map<String, String> formEncodings)
      throws MalformedURLException {
    URL pageUrl = null;
    if (sampler.isProtocolDefaultPort()) {
      pageUrl = new URL(sampler.getProtocol(), sampler.getDomain(), request.getPath());
    } else {
      pageUrl =
          new URL(sampler.getProtocol(), sampler.getDomain(), sampler.getPort(), request.getPath());
    }
    String urlWithoutQuery = request.getUrlWithoutQuery(pageUrl);

    String contentEncoding =
        computeContentEncoding(request, pageEncodings, formEncodings, urlWithoutQuery);

    // Set the content encoding
    if (!StringUtils.isEmpty(contentEncoding)) {
      sampler.setContentEncoding(contentEncoding);
    }
  }
 /**
  * Set Port on sampler
  *
  * @param sampler {@link HTTPSamplerBase}
  * @param request {@link HttpRequestHdr}
  */
 protected void computePort(HTTPSamplerBase sampler, HttpRequestHdr request) {
   sampler.setPort(request.serverPort());
   if (log.isDebugEnabled()) {
     log.debug("Proxy: setting port: " + sampler.getPort());
   }
 }