IPhone Connectivity Testing: How do I force it to lose connection?

cocoa-touch, iphone, objective-c

Solution

If you're developing in the iPhone Simulator, simply disconnect your computer from the internet. If your computer has no network access, neither does the iPhone Simulator.

To test on the device, you can do the following:

First, setup a WiFi router that you can use for testing.

You can turn on Airplane mode on the phone, then turn WiFi back on. This will prevent the 3G connection from providing data access.

Launch your application. Now you can simply disconnect your WiFi router to simulate a loss of connectivity.

Problem

Apple wants me to give the user a friendly apology if I can't find an internet connection. Using the Reachability Demo, this was easy enough. I want to take it a step further and monitor for a connection loss. The demo has this functionality, but I can't figure out how to shut my connection off to test if it works. How would I go about simulating a loss of (or actually losing) a connection?

Original source