Proxies for Mobile App Testing
Mobile apps need to work correctly across different network conditions, geographic locations, and IP environments. Proxy infrastructure lets your QA team simulate these conditions without maintaining devices in multiple countries or on multiple networks.
Android Emulator Proxy Configuration
Configure the Android emulator to route all traffic through Hex Proxies:
# Launch emulator with proxy settings
emulator -avd Pixel_6_API_34 \
-http-proxy http://YOUR_USER:YOUR_PASS@gate.hexproxies.com:8080For programmatic configuration in your test setup:
// In your Android test setup
val proxyHost = "gate.hexproxies.com"System.setProperty("http.proxyHost", proxyHost) System.setProperty("http.proxyPort", proxyPort.toString()) System.setProperty("https.proxyHost", proxyHost) System.setProperty("https.proxyPort", proxyPort.toString()) ```
iOS Simulator Proxy Configuration
iOS simulators inherit the macOS system proxy settings. Configure them via networksetup:
# Set proxy for Wi-Fi interface (used by simulator)
networksetup -setwebproxy Wi-Fi gate.hexproxies.com 8080 on YOUR_USER YOUR_PASS# Reset after testing networksetup -setwebproxystate Wi-Fi off networksetup -setsecurewebproxystate Wi-Fi off ```
Appium Test Integration
Configure Appium tests to route traffic through proxies:
from appium import webdriveroptions = UiAutomator2Options() options.platform_name = "Android" options.device_name = "emulator-5554" options.app = "/path/to/app.apk"
# Add proxy capability options.set_capability("proxy", { "httpProxy": "gate.hexproxies.com:8080", "sslProxy": "gate.hexproxies.com:8080", "proxyType": "MANUAL", })
driver = webdriver.Remote("http://localhost:4723", options=options) ```
Testing Geo-Targeted Mobile Content
Mobile apps frequently serve different content based on IP location. Test each regional variant:
import subprocess@dataclass(frozen=True) class MobileGeoTestConfig: country: str proxy_url: str expected_currency: str expected_language: str
def build_configs(username: str, password: str) -> list[MobileGeoTestConfig]: regions = [ ("US", "USD", "en"), ("GB", "GBP", "en"), ("DE", "EUR", "de"), ("JP", "JPY", "ja"), ("BR", "BRL", "pt"), ] return [ MobileGeoTestConfig( country=country, proxy_url=f"http://{username}-country-{country.lower()}:{password}@gate.hexproxies.com:8080", expected_currency=currency, expected_language=lang, ) for country, currency, lang in regions ] ```
API Response Testing Through Proxy
Intercept and verify mobile API responses across different IP environments:
def test_mobile_api(endpoint: str, country: str, username: str, password: str) -> dict: """Simulate a mobile API request from a specific country.""" proxy = f"http://{username}-country-{country.lower()}:{password}@gate.hexproxies.com:8080" with httpx.Client(proxy=proxy, timeout=15) as client: resp = client.get(endpoint, headers={ "User-Agent": "MyApp/2.1.0 (Android 14; Pixel 8)", "X-App-Version": "2.1.0", "Accept": "application/json", }) return { "country": country, "status": resp.status_code, "headers": dict(resp.headers), "body": resp.json(), } ```
Network Condition Simulation
While proxies primarily address IP diversity and geo-targeting, combining them with network throttling gives comprehensive mobile testing:
# Android emulator with proxy and network throttle
emulator -avd Pixel_6_API_34 \
-http-proxy http://YOUR_USER:YOUR_PASS@gate.hexproxies.com:8080 \
-netdelay 3g \
-netspeed 3gCI/CD Integration for Mobile Geo-Tests
Run automated mobile geo-tests as part of your release pipeline. Hex Proxies ISP proxies deliver sub-50ms latency, keeping your CI pipeline fast while providing realistic IP diversity for mobile app testing across multiple regions.