mid-session app resetting refactoring, server flag

@bootstrap, i decided to separate things a bit more in case we have android devices or windows devices in the future (i.e., move logic out of controller.js into appium.js / ios.js)

and i added a test.