code: private void updateSession(Session newSession) {
          if (this.currentSession == null) {
              this.currentSession = newSession;
          } else {
              synchronized (this.currentSession) {
                  this.currentSession = newSession;
              }
          }
      }
docs: Overwrites the underlying WebSocket session.
  
  @param newSession new session