How to access a local host or service from a virtual device?
Note
The following methods only apply if Genymotion Desktop and the server/service run on the same host machine.
If an application connects to a local server or service, such as a REST service, the virtual device may need access to the local host.
With VirtualBox
Use the IP address 10.0.3.2 from the virtual device to reach the service or server.
10.0.3.2 is a VirtualBox alias to the host loopback interface (127.0.0.1 on the host machine).
If a host service listens on localhost:1234, it can be accessed from the virtual device as 10.0.3.2:1234.
With QEMU
QEMU has no loopback interface.
adb reverse binds a virtual device port to a host port, enabling access to a host service.
If a host service listens on localhost:1234, run: adb reverse tcp:1234 tcp:1234.
This binds the virtual device local TCP port 1234 to the host machine local TCP port 1234.
Thus, the service can be accessed from the virtual device using localhost:1234.