Today I am running Mathematica from a computer that is permanently connected to our university network. Because of a number of reasons, I am not allowed to disconnect my computer from our network.
My conflict is that I have some code I wish to test that depends on whether the computer is connected to the Internet or otherwise. How can I pretend my computer is not connected to the Internet for testing?
I know about
$NetworkConnected to check if the computer is connected, but temporarily setting it to
Block does not seem to work.
As a simple example of code that needs an Internet connection for testing purposes, you can use