Source:
public HttpConnection execute() throws IOException { boolean retry = true; int n = maxRetries; while (retry && n-- > 0) { this.responseCode = -1; System.setProperty("http.keepAlive", "false"); connection = (HttpURLConnection) url.openConnection(); for (String key : requestProperties.keySet()) { connection.setRequestProperty(key, requestProperties.get(key)); } connection.setDoInput(true); connection.setRequestMethod(requestMethod); if (contentType != null) { connection.setRequestProperty("Content-type", contentType); } if (url.getUserInfo() != null) { ByteArrayOutputStream baos = new ByteArrayOutputStream(); OutputStream bos = Base64OutputStreamFactory.get(baos); bos.write(url.getUserInfo().getBytes()); bos.flush(); bos.close(); String encodedAuth = baos.toString(); connection.setRequestProperty("Authorization", String.format("Basic %s", encodedAuth)); } HttpConnectionFilterContext currentContext = new HttpConnectionFilterContext(this); for (HttpConnectionRequestFilter requestFilter : requestFilters) { currentContext = requestFilter.filterRequest(currentContext); } if (input != null) { connection.setDoOutput(true); if (inputLength != -1) { connection.setFixedLengthStreamingMode((int)this.inputLength); } else { connection.setChunkedStreamingMode(1024); } connection.setRequestProperty("Expect", "100-continue"); int bufSize = 1024; int nRead = 0; byte[] buf = new byte[bufSize]; InputStream is = input; OutputStream os = connection.getOutputStream(); while((nRead = is.read(buf)) >= 0) { os.write(buf, 0, nRead); } os.flush(); } this.responseCode = connection.getResponseCode(); for (HttpConnectionResponseFilter responseFilter : responseFilters) { currentContext = responseFilter.filterResponse(currentContext); } retry = currentContext.replayRequest; } return this; }

Target:
public HttpConnection execute() throws IOException { boolean retry = true; int n = numberOfRetries; while (retry && n-- > 0) { System.setProperty("http.keepAlive", "false"); connection = (HttpURLConnection) url.openConnection(); for (String key : requestProperties.keySet()) { connection.setRequestProperty(key, requestProperties.get(key)); } connection.setRequestProperty("User-Agent", userAgent); if (url.getUserInfo() != null) { ByteArrayOutputStream baos = new ByteArrayOutputStream(); OutputStream bos = Base64OutputStreamFactory.get(baos); bos.write(url.getUserInfo().getBytes()); bos.flush(); bos.close(); String encodedAuth = baos.toString(); connection.setRequestProperty("Authorization", String.format("Basic %s", encodedAuth)); } connection.setDoInput(true); connection.setRequestMethod(requestMethod); if (contentType != null) { connection.setRequestProperty("Content-type", contentType); } HttpConnectionFilterContext currentContext = new HttpConnectionFilterContext(this); for (HttpConnectionRequestFilter requestFilter : requestFilters) { currentContext = requestFilter.filterRequest(currentContext); } if (input != null) { connection.setDoOutput(true); if (inputLength != -1) { connection.setFixedLengthStreamingMode((int) this.inputLength); } else { connection.setChunkedStreamingMode(1024); } connection.setRequestProperty("Expect", "100-continue"); int bufSize = 1024; int nRead = 0; byte[] buf = new byte[bufSize]; InputStream is = input; OutputStream os = connection.getOutputStream(); while ((nRead = is.read(buf)) >= 0) { os.write(buf, 0, nRead); } os.flush(); } for (HttpConnectionResponseFilter responseFilter : responseFilters) { currentContext = responseFilter.filterResponse(currentContext); } retry = currentContext.replayRequest; if (n == 0) { logger.info("Maximum number of retries reached"); } } return this; }