Source:
private DirectNetworkUsageAnswer getPublicIpBytesSentAndReceived(DirectNetworkUsageCommand cmd) throws ExecutionException { DirectNetworkUsageAnswer answer = new DirectNetworkUsageAnswer(cmd); try { URL trafficSentinel; if (_inclZones == null) { _inclZones = cmd.getIncludeZones(); } if (_exclZones == null) { _exclZones = cmd.getExcludeZones(); } try { trafficSentinel = new URL(_url + "/inmsf/Query"); String postData = "script="+URLEncoder.encode(getScript(cmd.getPublicIps(), cmd.getStart(), cmd.getEnd()), "UTF-8")+"&authenticate=basic&resultFormat=txt"; HttpURLConnection con = (HttpURLConnection) trafficSentinel.openConnection(); con.setRequestMethod("POST"); con.setRequestProperty("Content-Length", String.valueOf(postData.length())); con.setDoOutput(true); OutputStream os = con.getOutputStream(); os.write(postData.getBytes("UTF-8")); BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream())); String inputLine; while ((inputLine = in.readLine()) != null) { StringTokenizer st = new StringTokenizer(inputLine, ","); if (st.countTokens() == 3) { String publicIp = st.nextToken(); Long bytesSent = new Long(st.nextToken()); Long bytesRcvd = new Long(st.nextToken()); long[] bytesSentAndReceived = new long[2]; bytesSentAndReceived[0] = bytesSent; bytesSentAndReceived[1] = bytesRcvd; answer.put(publicIp, bytesSentAndReceived); } } os.close(); in.close(); } catch (MalformedURLException e1) { s_logger.info("Invalid Traffic Sentinel URL", e1); throw new ExecutionException(e1.getMessage()); } catch (IOException e) { s_logger.debug("Error in direct network usage accounting", e); throw new ExecutionException(e.getMessage()); } } catch (Exception e) { s_logger.debug(e); throw new ExecutionException(e.getMessage()); } return answer; }

Target:
private DirectNetworkUsageAnswer getPublicIpBytesSentAndReceived(DirectNetworkUsageCommand cmd) throws ExecutionException { DirectNetworkUsageAnswer answer = new DirectNetworkUsageAnswer(cmd); try { URL trafficSentinel; if (_inclZones == null) { _inclZones = cmd.getIncludeZones(); } if (_exclZones == null) { _exclZones = cmd.getExcludeZones(); } BufferedReader in = null; OutputStream os = null; try { trafficSentinel = new URL(_url + "/inmsf/Query"); String postData = "script="+URLEncoder.encode(getScript(cmd.getPublicIps(), cmd.getStart(), cmd.getEnd()), "UTF-8")+"&authenticate=basic&resultFormat=txt"; HttpURLConnection con = (HttpURLConnection) trafficSentinel.openConnection(); con.setRequestMethod("POST"); con.setRequestProperty("Content-Length", String.valueOf(postData.length())); con.setDoOutput(true); os = con.getOutputStream(); os.write(postData.getBytes("UTF-8")); in = new BufferedReader(new InputStreamReader(con.getInputStream())); String inputLine; while ((inputLine = in.readLine()) != null) { StringTokenizer st = new StringTokenizer(inputLine, ","); if (st.countTokens() == 3) { String publicIp = st.nextToken(); Long bytesSent = new Long(st.nextToken()); Long bytesRcvd = new Long(st.nextToken()); long[] bytesSentAndReceived = new long[2]; bytesSentAndReceived[0] = bytesSent; bytesSentAndReceived[1] = bytesRcvd; answer.put(publicIp, bytesSentAndReceived); } } } catch (MalformedURLException e1) { s_logger.info("Invalid Traffic Sentinel URL", e1); throw new ExecutionException(e1.getMessage()); } catch (IOException e) { s_logger.debug("Error in direct network usage accounting", e); throw new ExecutionException(e.getMessage()); } finally { if (os != null) { os.close(); } if (in != null) { in.close(); } } } catch (Exception e) { s_logger.debug(e); throw new ExecutionException(e.getMessage()); } return answer; }