I do not have a complete answer for you, but I have some links that may help.
One of Apple’s tools for developers in OS X is the Network Link Conditioner, which can be used to simulate various network conditions. These include “drop all packets” (although I suspect that this may not be what you mean by “disconnected network”).
This post explains the tool pretty well. Please note that now this is an optional download (more details here ).
The same function (with the same name) is built into iOS (min iOS 6, apparently, only on the device, not on the simulator). It can be configured by going to Settings > Developer > Network Link Conditioner - see this post .
I do not know if it is possible to enable / disable them through UIAutomation, sorry.
source share