jmeter-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject [Bug 63015] Abnormal NoHttpResponseException when running request through proxy after a first failing request
Date Tue, 18 Dec 2018 13:13:36 GMT
https://bz.apache.org/bugzilla/show_bug.cgi?id=63015

--- Comment #5 from Philippe Mouawad <p.mouawad@ubik-ingenierie.com> ---
I reproduced issue with HC4:


    @Test
    public void bugWithPostAndProxy() throws Exception {
        PoolingHttpClientConnectionManager pHCCM = new
PoolingHttpClientConnectionManager(2000, TimeUnit.MILLISECONDS);
        pHCCM.setDefaultMaxPerRoute(5);
        pHCCM.setValidateAfterInactivity(1700);
        HttpHost proxy = new HttpHost("localhost", 8888, "http");

        RequestConfig config = RequestConfig.custom().setProxy(proxy).build();

        try (CloseableHttpClient httpclient = HttpClients.custom().
                setConnectionManager(pHCCM).
                setDefaultSocketConfig(SocketConfig.DEFAULT).
                setConnectionTimeToLive(2000, TimeUnit.MILLISECONDS).
                setRetryHandler(new StandardHttpRequestRetryHandler(0, false)).
               
setConnectionReuseStrategy(DefaultClientConnectionReuseStrategy.INSTANCE).
                build()) {
            HttpHost target = new HttpHost("jmeter.apache.org");
            HttpPost request = new HttpPost("/404.html");
            request.addHeader("Content-Type",
"application/x-www-form-urlencoded; charset=UTF-8");
            request.addHeader("Connection", "keep-alive");
            request.setConfig(config);
            HttpContext httpContext = new BasicHttpContext();
            httpContext.setAttribute(HttpClientContext.USER_TOKEN, "Thread
Group1-1");
            try (CloseableHttpResponse response = httpclient.execute(target,
request, httpContext)) {
                logger.info("Headers:{}", response.getEntity().toString());
                EntityUtils.consumeQuietly(response.getEntity());
                logger.info("Headers:{}", response.getAllHeaders());
            }
            request = new HttpPost("/404.html");
            request.addHeader("Connection", "keep-alive");
            try (CloseableHttpResponse response = httpclient.execute(target,
request, httpContext)) {
                EntityUtils.consumeQuietly(response.getEntity());
                logger.info("Headers:{}", response.getEntity().toString());
                logger.info("Headers:{}", response.getAllHeaders());
            }
        } 
    }

-- 
You are receiving this mail because:
You are the assignee for the bug.
Mime
View raw message