code: @Override
      protected boolean initiateClient()
      {
          try
          {
              SchemeSocketFactory ssf = null;
              ssf = PlainSocketFactory.getSocketFactory();
              SchemeRegistry schemeRegistry = new SchemeRegistry();
              schemeRegistry.register(new Scheme("http", Integer.parseInt(port), ssf));
              PoolingClientConnectionManager ccm = new PoolingClientConnectionManager(schemeRegistry);
              httpClient = new DefaultHttpClient(ccm);
              httpHost = new HttpHost(hosts[0], Integer.parseInt(port), "http");
              // Http params
              httpClient.getParams().setParameter(CoreProtocolPNames.HTTP_CONTENT_CHARSET, "UTF-8");
  
              // basic authentication
              if (userName != null && password != null)
              {
                  ((AbstractHttpClient) httpClient).getCredentialsProvider().setCredentials(
                          new AuthScope(hosts[0], Integer.parseInt(port)),
                          new UsernamePasswordCredentials(userName, password));
              }
              // request interceptor
              ((DefaultHttpClient) httpClient).addRequestInterceptor(new HttpRequestInterceptor()
              {
                  public void process(final HttpRequest request, final HttpContext context) throws IOException
                  {
                      if (logger.isInfoEnabled())
                      {
                          RequestLine requestLine = request.getRequestLine();
                          logger.info(">> " + requestLine.getMethod() + " " + URI.create(requestLine.getUri()).getPath());
                      }
                  }
              });
              // response interceptor
              ((DefaultHttpClient) httpClient).addResponseInterceptor(new HttpResponseInterceptor()
              {
                  public void process(final HttpResponse response, final HttpContext context) throws IOException
                  {
                      if (logger.isInfoEnabled())
                          logger.info("<< Status: " + response.getStatusLine().getStatusCode());
                  }
              });
          }
          catch (Exception e)
          {
              logger.error("Error Creating HTTP client {}. ", e);
              throw new IllegalStateException(e);
          }
          return true;
  
      }
docs: Instantiate http client.
  
  @return true, if successful