moved callback to release session to after we have cleared the session
Merge pull request #1002 from snevesbarros/release_session_fix

Minor fix to clear session before releasing the session
factor more code out of controller into its own module
this fixes an issue with proxying since proxy.js and controller.js were
requiring each other and causing a bug for selendroid / chrome
add test to make sure selendroid can proxy errors