String message = data.substring(0, 20).replaceAll(" ", "");
logger.debug(data);
if (message.startsWith("{\"handshake\"")) {
// This will fail if the message is not well formed.
HandshakeMessage handshakeMessage = mapper.readValue(data, HandshakeMessage.class);
// If we missed the CloseReason for whatever reason (IE is a good candidate), make sure we swap the previous session anyway.
String identity = (String) getContextValue(request, IDENTITY);
if (identity == null) {
identity = UUID.randomUUID().toString();