private static boolean setProxy(Context ctx, String host, int port) { boolean ret = false; try { Object requestQueueObject = getRequestQueue(ctx); if (requestQueueObject != null) { // Create Proxy config object and set it into request Q HttpHost httpHost = new HttpHost(host, port, "http"); setDeclaredField(requestQueueObject, "mProxyHost", httpHost); // LogWrapper.d("Webkit Setted Proxy to: " + host + ":" + port); ret = true; } } catch (Exception e) { APL.getEventReport().send(new Exception("Exception setting WebKit proxy settings", e)); } return ret; }
public static void resetProxy(Context ctx) throws Exception { Object requestQueueObject = getRequestQueue(ctx); if (requestQueueObject != null) { setDeclaredField(requestQueueObject, "mProxyHost", null); } }