Throttling Android Simulator via Custom Networking Parameters

This is how you can easily throttle Android networking interface on the emulator. You can go via telnet or netcat.

##TL;DR To set the network interface to have throughput of 6000 bits/s (0.7 KB/s) and 2000 ms latency you would use these commands (for the first emulator that usually defaults to port 5554)

echo "network delay 2000" | nc localhost 5554
echo "network speed 6 6" | nc localhost 5554

For more details and samples read on…

Latency

echo "network delay 8000" | nc localhost 5554
Sample output:
➜  ~  echo "network delay 8000" | nc localhost 5554
Android Console: type 'help' for a list of commands
OK
OK
➜  ~  echo "network status" | nc localhost 5554
Android Console: type 'help' for a list of commands
OK
Current network status:
  download speed:          0 bits/s (0.0 KB/s)
  upload speed:            0 bits/s (0.0 KB/s)
  minimum latency:  8000 ms
  maximum latency:  8000 ms
OK

Throughput

echo "network speed 6 6" | nc localhost 5554
Sample output:
➜  ~  echo "network speed 6 6" | nc localhost 5554
Android Console: type 'help' for a list of commands
OK
OK
➜  ~  echo "network status" | nc localhost 5554
Android Console: type 'help' for a list of commands
OK
Current network status:
  download speed:       6000 bits/s (0.7 KB/s)
  upload speed:         6000 bits/s (0.7 KB/s)
  minimum latency:  8000 ms
  maximum latency:  8000 ms
OK

List of network commands

➜  ~  echo "network" | nc localhost 5554
Android Console: type 'help' for a list of commands
OK
allows you to manage the settings related to the network data connection of the
emulated device.

available sub-commands:
    status           dump network status
    speed            change network speed
    delay            change network latency
    capture          dump network packets to file

All available commands

➜  ~  echo "help" | nc localhost 5554
Android Console: type 'help' for a list of commands
OK
Android console command help:

    help|h|?         print a list of commands
    event            simulate hardware events
    geo              Geo-location commands
    gsm              GSM related commands
    cdma             CDMA related commands
    kill             kill the emulator instance
    network          manage network settings
    power            power related commands
    quit|exit        quit control session
    redir            manage port redirections
    sms              SMS related commands
    avd              control virtual device execution
    window           manage emulator window
    qemu             QEMU-specific commands
    sensor           manage emulator sensors

try 'help <command>' for command-specific help
OK