Search code examples
androidadb

How to make adb server not respond?


We have test suite where adb clients connect to multiple android devices. Our test suite raises these requests to connect, get device state and run applications in it.

I would like to simulate a scenario where adb server hangs. I tried issuing "adb kill-server" but any adb request from client starts the adb server. Is there anyway we can stop the adb server from listening to adb client requests ?

Of course there is a long way of compiling adb service and changing the code our self. But any easy way to get this done?


Solution

  • Do you need to still have a connection (that doesn't respond to commands), or is it fine to kill the connection altogether? Sounds to me like killing the connection would be fine since you say that you tried adb kill-server.

    In that case, how about trying to connect to the device in TCP/IP mode without having set up the adb server to listen on a network port? I.e. something like:

    adb tcpip 12345