Package org.springframework.web.socket

Examples of org.springframework.web.socket.CloseStatus


    }
  }

  @OnWebSocketClose
  public void onWebSocketClose(int statusCode, String reason) {
    CloseStatus closeStatus = new CloseStatus(statusCode, reason);
    try {
      this.webSocketHandler.afterConnectionClosed(this.wsSession, closeStatus);
    }
    catch (Throwable t) {
      logger.error("Unhandled error for " + this.wsSession, t);
View Full Code Here


    assertEquals(SockJsFrame.closeFrameGoAway(), this.session.getSockJsFramesWritten().get(0));

    assertEquals(1, this.session.getNumberOfLastActiveTimeUpdates());
    assertTrue(this.session.didCancelHeartbeat());

    assertEquals(new CloseStatus(3000, "Go away!"), this.session.getCloseStatus());
    assertClosed();
    verify(this.webSocketHandler).afterConnectionClosed(this.session, new CloseStatus(3000, "Go away!"));
  }
View Full Code Here

    this.session.delegateConnectionEstablished();
    this.session.setActive(true);
    this.session.close();

    assertEquals(new CloseStatus(3000, "Go away!"), this.session.getCloseStatus());
    assertClosed();
  }
View Full Code Here

        if (sockJsSession.isDisconnected()) {
          sockJsSession.afterTransportClosed(null);
        }
        else {
          sockJsSession.handleTransportError(failure);
          sockJsSession.afterTransportClosed(new CloseStatus(1006, failure.getMessage()));
        }
      }
    };

  }
View Full Code Here

      if (this.session.isDisconnected()) {
        this.session.afterTransportClosed(null);
      }
      else {
        this.session.handleTransportError(failure);
        this.session.afterTransportClosed(new CloseStatus(1006, failure.getMessage()));
      }
    }
View Full Code Here

      if (this.sockJsSession.isDisconnected()) {
        this.sockJsSession.afterTransportClosed(null);
      }
      else {
        this.sockJsSession.handleTransportError(failure);
        this.sockJsSession.afterTransportClosed(new CloseStatus(1006, failure.getMessage()));
      }
    }
View Full Code Here

   */
  Runnable getTimeoutTask() {
    return new Runnable() {
      @Override
      public void run() {
        closeInternal(new CloseStatus(2007, "Transport timed out"));
      }
    };
  }
View Full Code Here

      if (logger.isDebugEnabled()) {
        logger.debug("Open frame received in " + getId() + " but we're not" +
            "connecting (current state=" + this.state + "). The server might " +
            "have been restarted and lost track of the session.");
      }
      closeInternal(new CloseStatus(1006, "Server lost session"));
    }
  }
View Full Code Here

      }
    }
  }

  private void handleCloseFrame(SockJsFrame frame) {
    CloseStatus closeStatus = CloseStatus.NO_STATUS_CODE;
    try {
      String[] data = getMessageCodec().decode(frame.getFrameData());
      if (data.length == 2) {
        closeStatus = new CloseStatus(Integer.valueOf(data[0]), data[1]);
      }
      if (logger.isDebugEnabled()) {
        logger.debug("Processing SockJS close frame with " + closeStatus + " in " + this);
      }
    }
View Full Code Here

            if (!connectFuture.isDone()) {
              connectFuture.setException(ex);
            }
            else {
              session.handleTransportError(ex);
              session.afterTransportClosed(new CloseStatus(1006, ex.getMessage()));
            }
            break;
          }
        }
      }
View Full Code Here

TOP

Related Classes of org.springframework.web.socket.CloseStatus

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.