Skip to content

fix: use host machine IP for real devices instead of adb reverse#94

Open
slava-markovski-unity wants to merge 1 commit into
AppiumTestDistribution:masterfrom
slava-markovski-unity:fix/real-device-stf-proxy-ip
Open

fix: use host machine IP for real devices instead of adb reverse#94
slava-markovski-unity wants to merge 1 commit into
AppiumTestDistribution:masterfrom
slava-markovski-unity:fix/real-device-stf-proxy-ip

Conversation

@slava-markovski-unity

@slava-markovski-unity slava-markovski-unity commented Jun 3, 2026

Copy link
Copy Markdown

Problem

adb reverse silently fails through ADB relay setups (STF, Headspin, and any device farm that proxies ADB connections). The command exits 0 but the reverse tunnel is never actually established on the device side — from the device's perspective there is nothing listening on localhost:PORT, so every HTTPS CONNECT through the proxy fails with:

java.io.IOException: unexpected end of stream
  at okhttp3.internal.connection.RealConnection.createTunnel
  at okhttp3.internal.connection.RealConnection.connectTunnel

This makes the plugin completely non-functional on any device farm using an ADB relay.

Two additional issues affect Linux CI / STF setups:

proxy.js binds to :: (IPv6-only): On Linux, binding to :: with IPV6_V6ONLY=1 (the default) only accepts IPv6 connections. Physical devices and emulators connecting via IPv4 (e.g. 192.168.x.x) get Connection refused. Fix: bind to 0.0.0.0 (accepts both IPv4 and IPv6 via dual-stack).

utils/proxy.js uses localhost for real devices: After the adb reverse tunnel is removed, the host IP must be used for all device types — not just emulators. See the main fix below.

Fix

  1. utils/proxy.js — use the host machine's public IPv4 for all device types instead of localhost + adb reverse. Physical devices reach the proxy over Wi-Fi. Emulators can reach the host IP just as well as before. The adb reverse call is removed since it is no longer needed.

  2. proxy.ts — change host: '::' to host: '0.0.0.0' so the proxy binds to all interfaces and accepts IPv4 connections on Linux CI.

Verified on

  • Local AVD (Android emulator) — works
  • STF with physical Pixel 6 running Android 16 — works
  • Linux CI agent (STF) — both fixes required for reliable operation

adb reverse silently fails through ADB relay setups (STF, Headspin,
and any device farm that proxies ADB connections). The reverse tunnel
command exits 0 but is never established on the device side, so
connections to localhost:PORT on the device get nothing and fail with
'unexpected end of stream'.

Using the host machine's public IPv4 directly works for both physical
devices (reachable over Wi-Fi on the same network as the Appium host)
and emulators, with no regression.

Verified on:
- Local AVD (Android emulator) — fix works
- STF with physical Pixel 6 running Android 16 — fix works
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant