public Object invoke(Object proxy, Method m, Object[] args) throws Throwable { int retry = _strategy.getRetryAttempts(); Object result = null; do { HttpURLConnection c = null; try { c = (HttpURLConnection) UrlUtilities.getConnection(_strategy.buildURL(proxy, m, args), true, true, false); c.setRequestMethod("POST"); _strategy.setCookies(c); // Formulate the POST data for the output stream. byte[] bytes = _strategy.generatePostData(proxy, m, args); c.setRequestProperty("Content-Length", String.valueOf(bytes.length)); _strategy.setRequestHeaders(c); // send the post data IOUtilities.transfer(c, bytes); _strategy.getCookies(c); // Get the return value of the call result = _strategy.readResponse(c); } catch (ThreadDeath e) { throw e; } catch (Throwable e) { LOG.error("Error occurred getting HTTP response from server", e); UrlUtilities.readErrorResponse(c); if (retry-- > 0) { Thread.sleep(_strategy.getRetrySleepTime()); } } finally { UrlUtilities.disconnect(c); } } while (retry > 0); try { checkForThrowable(result); } catch (Throwable t) { LOG.error("Error occurred on server", t); return null; } return result; }