Java Code Examples for net.lightbody.bmp.BrowserMobProxy#getHostNameResolver()

The following examples show how to use net.lightbody.bmp.BrowserMobProxy#getHostNameResolver() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DeviceUtils.java    From AndroidHttpCapture with MIT License 5 votes vote down vote up
public static void changeHost(BrowserMobProxy browserMobProxy,String newValue){
    AdvancedHostResolver advancedHostResolver = browserMobProxy.getHostNameResolver();
    advancedHostResolver.clearHostRemappings();
    for (String temp : newValue.split("\\n")) {
        if (temp.split(" ").length == 2) {
            advancedHostResolver.remapHost(temp.split(" ")[1], temp.split(" ")[0]);
            Log.e("~~~~remapHost ", temp.split(" ")[1] + " " + temp.split(" ")[0]);
        }
    }


    browserMobProxy.setHostNameResolver(advancedHostResolver);
}
 
Example 2
Source File: SettingsActivity.java    From AndroidHttpCapture with MIT License 5 votes vote down vote up
public String getHost() {
    String result = "";
    BrowserMobProxy browserMobProxy = ((SysApplication) getApplication()).proxy;
    AdvancedHostResolver advancedHostResolver = browserMobProxy.getHostNameResolver();
    for (String key : advancedHostResolver.getHostRemappings().keySet()) {
        result += key + " " + advancedHostResolver.getHostRemappings().get(key) + "\n";
    }
    return result.length() > 1 ? result.substring(0, result.length() - 1) : "无";
}