OF-2480: Ensure that admin console starts after setup
During setup, the CertificateStore manager is started briefly, to ensure that it contains at least a minimum viable certificate. After this has been established, it is shut down again.
This brief occurrence starts an entity that watches the file system for changes (OF-1373: Allow certificate changes to be applied without a restart). Having this watcher running prevents the admin console webserver from being restarted quickly, causing the admin console to be unavailable for about half a minute.
With the changes in this commit, the initial start of CertificateStoreManager will now happen without the 'watching' being started. This prevents issues with reloading the web server.
OF-2473: Guard access to websocket session state
By having more asynchronous operations being introduced as part of OF-2473, the need to guard state increased. This commit adds some mutexes.
OF-2473: Ensure throwables are not lost
If the implementation of the `@OnWebSocketError` annotated methods throws an exception, this exception should not be lost.
OF-2473: Prevent websocket deadlock
Jetty's websocket implementation invokes `@OnWebSocketError` and `@OnWebSocketClose` annotated methods when certain erroneous conditions occur. These invocations happen synchronously.
As a result, a 'close' operation is called synchronously to the processing of the original request, which can happen under guard of a mutex. This leads to the 'close' implementation being called while a mutex is held that is intended to be held only while inbound data is being processed. This has lead to deadlocks.
An example scenario is when a websocket request arrives that asks to close the connection. Sometimes (presumably if the per immediately disconnects the connection, rather than waiting for an answer), returning a response fails ('EOF'). This then triggers error handling.
This commit makes the `@OnWebSocketError` and `@OnWebSocketClose` methods be asynchronous, to ensure that its processing is decoupled from the inbound data that might have tirggered their invocation.
OF-2479: Allow clients that do websockets without the required XMPP framing
This basically is a hack to get Tsung to connect to Openfire of websockets.
The functionality introduced here is switched off by default. If enabled, it replaces `stream` element names with `open` and `close` where appropriate, to conform to 'XMPP framing' as described in https://datatracker.ietf.org/doc/html/rfc7395#section-3.3