private void sendRequest(HttpSender httpSender) throws Exception {
    log.trace("sendRequest()");
    try {
      // If we're using SSL, we need to include the provider name in
      // the HTTP request so that server proxy could verify the SSL
      // certificate properly.
      if (SystemProperties.isSslEnabled()) {
        httpSender.setAttribute(AuthTrustVerifier.ID_PROVIDERNAME, requestServiceId);
      }

      // Start sending the request to server proxies. The underlying
      // SSLConnectionSocketFactory will select the fastest address
      // (socket that connects first) from the provided addresses.
      // Dummy service address is only needed so that host name resolving
      // could do its thing and start the ssl connection.
      URI[] addresses = getServiceAddresses(requestServiceId, requestSoap.getSecurityServer());
      httpSender.setAttribute(ID_TARGETS, addresses);
      httpSender.setTimeout(SystemProperties.getClientProxyTimeout());

      httpSender.addHeader(HEADER_HASH_ALGO_ID, getHashAlgoId());
      httpSender.addHeader(HEADER_PROXY_VERSION, ProxyMain.getVersion());

      try {
        httpSender.doPost(
            getDummyServiceAddress(addresses), reqIns, CHUNKED_LENGTH, outputContentType);
      } catch (Exception e) {
        // Failed to connect to server proxy
        MonitorAgent.serverProxyFailed(createRequestMessageInfo());
        // Rethrow
        throw e;
      }
    } finally {
      if (reqIns != null) {
        reqIns.close();
      }
    }
  }