OF-2015: Clean up the donor immediately after session resumption.
When Stream Management is used to resume an old session, the session that was used to resume the old session should be cleaned up immediately. Before this fix, the session lingers in a state of being 'detached'. Not only is there no reason for it to linger (it can't be resumed), marking it as 'detached' is semantically wrong: this session never reached a state where it makes sense to resume it later. The changes in this commit clean up the donor session immediately after resuption.
OF-2014: Update OnConnectionClose callback object when re-initializing connection.
When a connection gets a new owner (Session), make sure that the old owner that was registered with the callback function gets replaced by the new owner. Without this, the callback will be invoked on the old (non-existing) session. This, among others, prevents Stream Management from working properly after a stream has been resumed for the first time.
OF-2013: Improve detection of 'detached' session state.
Instead of assuming that a session is detached when it's connection is null (which could also be caused by the connection being closed), verify if the session is currently in the collection of detached sessions.