hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Heather Carter <heatherc...@gmail.com>
Subject Bizarre issue with CloseableHttpClient , every other httpget works
Date Fri, 25 Mar 2016 03:56:59 GMT
I have a program that goes out and gets a file from a https site, which for
now I have
simulated with a method on my service since the real site isn't ready.

The simulating method that returns a file with lines to process (it reads a
file from a local resource dir and streams it out):

The method that will make the HttpGet call to the simulator to get the file
and do the work

I had to put in a timeout in my code so that I move past an issue where the
calls were hanging.
It now will successfully make the SSL handshake every other time.

 HttpGet get = null;
        RequestConfig params =
        String docRetrievalUrl = "
        get = new HttpGet(docRetrievalUrl);

        LOGGER.info(">>> getDoc{}");
        //sslClientFactory sets up keystore and truststore and
trustmanagers & keymanagers
        //for 2 way ssl
        try (CloseableHttpClient httpClient =
             CloseableHttpResponse response = httpClient.execute(get)  ){

if (response !=null) {
                HttpEntity entity = response.getEntity();
                if (entity !=null) {
                    InputStream is = entity.getContent();
                    InputStreamReader isr = new InputStreamReader(is);
                    BufferedReader br = new BufferedReader(isr);
                    LOGGER.error("Beggining to process content as csv");

                    try ( CSVReader csvReader = new CSVReader(br,',','"') )
                        String[] cells;
                        while ( (cells = csvReader.readNext()) != null ){

                            csvLines.add( new DataRow(cells) );


            } catch (IOException ex) {
               LOGGER("Problem " + ex.getMessage(),ex);

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message