Is it possible to make a program lose and get back it's internet connection by some other means than disconnecting/connecting the cable or putting the interface down/up?
That would be necessary in order to see how that program reacts to such situation.
In this case, it's one program's behaviour that I am interested in, so it would be enough to have just that one application lose its connection, but on the other hand, a solution that causes all programs to lose their connections is fine too.
A non-programmatic example of what I would like to emulate is when you have a switch between the computer and "whatever where the internet comes from" and you disconnect the cable between the internet and the switch. In that case, the computer loses it's connection but there is no way for that computer or the application to detect what exactly happened.