Source:
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 = new Base64OutputStream(baos, true, 0, null); 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); } HttpConnectionInterceptorContext currentContext = new HttpConnectionInterceptorContext(this); for (HttpConnectionRequestInterceptor requestInterceptor : requestInterceptors) { currentContext = requestInterceptor.interceptRequest(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 (HttpConnectionResponseInterceptor responseInterceptor : responseInterceptors) { currentContext = responseInterceptor.interceptResponse(currentContext); } retry = currentContext.replayRequest; if (n == 0) { logger.info("Maximum number of retries reached"); } } 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", AgentHelper.USER_AGENT); 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); } HttpConnectionInterceptorContext currentContext = new HttpConnectionInterceptorContext(this); for (HttpConnectionRequestInterceptor requestInterceptor : requestInterceptors) { currentContext = requestInterceptor.interceptRequest(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 (HttpConnectionResponseInterceptor responseInterceptor : responseInterceptors) { currentContext = responseInterceptor.interceptResponse(currentContext); } retry = currentContext.replayRequest; if (n == 0) { logger.info("Maximum number of retries reached"); } } return this; }