Network change during a test on iOS device

I wonder if it is possible to change a network during a test?
In my test suite I have an iOS device connected to a network shared from my computer. If I disable network before test (before calling webdriver.Remote(…) function) and enable network after calling quit() function on driver, then the next test started after this one - for which network settings were changed - is not started. I tried to manually call ideviceinstaller but it seems that the communication with the device is lost. I have to stop everything, reconnect device and then I can continue tests.
I am able to run my test when network is manually disabled before I start appium server and run the test. So it seems that the part which causes problem is network switch itself, not “no network” state.
Is this possible to enable/disable network before the test? If yes, what is the right moment? Seems that right before call to webdriver.Remote() is already too late.

kind regards,