I am trying to make my mobile application go through a proxy so that I can have a different ip address. Below are my attempt and it's not working. It's still giving me my own Ip address. How can I make my Android application go through appium server and then go through a proxy server?
I am using Proxy Manager from BrightData. it allow me to input all my proxies (host:port:username:password) and rotate it automatically. Proxy Manager give me a port to use which connect to those rotated proxies. Eventually I just want to use (host:port:username:password) but I don't know how to authenticate correctly
// Proxy Manager port which connect me to different proxies
String proxystring = "127.0.0.1:24000";
Proxy proxy = new Proxy();
proxy.setSslProxy(proxystring);
proxy.setHttpProxy(proxystring);
File appDir = new File("src");
File app = new File(appDir, "WhatismyIPaddress_v3.02_apkpure.com.apk");
DesiredCapabilities cap = new DesiredCapabilities();
cap.setCapability(MobileCapabilityType.DEVICE_NAME, "Pixel 3 API 30");
cap.setCapability(MobileCapabilityType.APP, app.getAbsolutePath());
cap.setCapability(MobileCapabilityType.AUTOMATION_NAME, "uiautomator2");
cap.setCapability(MobileCapabilityType.PROXY, proxy);
//127.0.0.1:4723 is the ip:port of appium server.
AndroidDriver<AndroidElement> driver = new AndroidDriver<AndroidElement>(new URL("http://127.0.0.1:4723/wd/hub"), cap);
TimeUnit.SECONDS.sleep(3);