Created by: bhaan
fixes #170 (closed) related to #171
The logout sequence has stopped working due to the logout initiation being coupled to the inSession state. As identified in #171, we were seeing the session immediately sending a test request after logon. By doing so, the session state transitioned from inSession to pendingTimeout. While the pendingTimeout state embeds the inSession state, the call to application.Stop only checks if the current state is the inSession state to initiate the logout sequence.
These changes move initiateLogout into the session, so the action on Stop can check IsLoggedOn, and initiate the logout sequence as necessary. Therefore all states that confirm true for the IsLoggedOn function interface, will result in a proper logout sequence.