Source:
public byte[] performRequest(String endpointUrl, List<NameValuePair> params) throws ServiceUnavailableException, IOException { if (MPConfig.DEBUG) { Log.v(LOGTAG, "Attempting request to " + endpointUrl); } byte[] response = null; int retries = 0; boolean succeeded = false; while (retries < 3 && !succeeded) { InputStream in = null; OutputStream out = null; BufferedOutputStream bout = null; HttpURLConnection connection = null; try { final URL url = new URL(endpointUrl); connection = (HttpURLConnection) url.openConnection(); connection.setConnectTimeout(2000); connection.setReadTimeout(10000); if (null != params) { connection.setDoOutput(true); final UrlEncodedFormEntity form = new UrlEncodedFormEntity(params, "UTF-8"); connection.setRequestMethod("POST"); connection.setFixedLengthStreamingMode((int)form.getContentLength()); out = connection.getOutputStream(); bout = new BufferedOutputStream(out); form.writeTo(bout); bout.close(); bout = null; out.close(); out = null; } in = connection.getInputStream(); response = Utilities.slurp(in); in.close(); in = null; succeeded = true; } catch (final EOFException e) { if (MPConfig.DEBUG) { Log.d(LOGTAG, "Failure to connect, likely caused by a known issue with Android lib. Retrying."); } retries = retries + 1; } catch (final IOException e) { if (503 == connection.getResponseCode()) { throw new ServiceUnavailableException("Service Unavailable", connection.getHeaderField("Retry-After")); } else { throw e; } } finally { if (null != bout) try { bout.close(); } catch (final IOException e) { ; } if (null != out) try { out.close(); } catch (final IOException e) { ; } if (null != in) try { in.close(); } catch (final IOException e) { ; } if (null != connection) connection.disconnect(); } } if (MPConfig.DEBUG) { if (retries >= 3) { Log.v(LOGTAG, "Could not connect to Mixpanel service after three retries."); } } return response; }

Target:
public byte[] performRequest(String endpointUrl, List<NameValuePair> params) throws ServiceUnavailableException, IOException { if (MPConfig.DEBUG) { Log.v(LOGTAG, "Attempting request to " + endpointUrl); } byte[] response = null; int retries = 0; boolean succeeded = false; while (retries < 3 && !succeeded) { InputStream in = null; OutputStream out = null; BufferedOutputStream bout = null; HttpURLConnection connection = null; try { final URL url = new URL(endpointUrl); connection = (HttpURLConnection) url.openConnection(); connection.setConnectTimeout(2000); connection.setReadTimeout(10000); if (null != params) { connection.setDoOutput(true); final UrlEncodedFormEntity form = new UrlEncodedFormEntity(params, "UTF-8"); connection.setRequestMethod("POST"); connection.setFixedLengthStreamingMode((int)form.getContentLength()); out = connection.getOutputStream(); bout = new BufferedOutputStream(out); form.writeTo(bout); bout.close(); bout = null; out.close(); out = null; } in = connection.getInputStream(); response = slurp(in); in.close(); in = null; succeeded = true; } catch (final EOFException e) { if (MPConfig.DEBUG) { Log.d(LOGTAG, "Failure to connect, likely caused by a known issue with Android lib. Retrying."); } retries = retries + 1; } catch (final IOException e) { if (503 == connection.getResponseCode()) { throw new ServiceUnavailableException("Service Unavailable", connection.getHeaderField("Retry-After")); } else { throw e; } } finally { if (null != bout) try { bout.close(); } catch (final IOException e) { ; } if (null != out) try { out.close(); } catch (final IOException e) { ; } if (null != in) try { in.close(); } catch (final IOException e) { ; } if (null != connection) connection.disconnect(); } } if (MPConfig.DEBUG) { if (retries >= 3) { Log.v(LOGTAG, "Could not connect to Mixpanel service after three retries."); } } return response; }