During an XCTestCase, I'd like to somehow say "disable internet" and it would effectively be disabled. Then later I'd like to somehow say "enable internet" and it would come back. The point is to see that my app behaves properly when network requests fail and then later succeed. What is the best way to do this?
Toggling airplane mode on and off could be sufficient, but I'm not aware of a way to do that. I've considered creating a dedicated simulator which is pre-configured to have the internet disabled, such as having airplane mode turned on, but that would limit my ability to run this test to one pre-configured simulator rather than the simulator (or device) of my choice.