OF-2424: Assert when LocalSession is null
Under certain circumstances (notably, when a session is detached), a session's connection can be null.
This commit adds assertions to identify the null-ability of a sessin's connection, and ensures that a null connection is not attempted to be used in a context where it is assumed to be non-null.
OF-2458: Guard access to field to prevent ConcurrentModificationException
The internal field 'presence' should not be modified when read, as that has been observed to lead to ConcurrentModificationException being thrown.
This commit adds a lock to all access to the 'presence' and related 'extendedInformation' fields, to prevent this from happening.
Additionaly, the instance returned by the `getPresence()` method has been replaced with a defensive copy (much of the invoking code did immediately create such a copy after acquiring the instance, which now has been removed).