Examples of CloseReason


Examples of javax.websocket.CloseReason

                // Ran out of input data - get some more
                return false;
            } else {
                // Ran out of message buffer - flush it
                if (!usePartial()) {
                    CloseReason cr = new CloseReason(CloseCodes.TOO_BIG,
                            sm.getString("wsFrame.bufferTooSmall",
                                    Integer.valueOf(
                                            messageBufferBinary.capacity()),
                                    Long.valueOf(payloadLength)));
                    throw new WsIOException(cr);
View Full Code Here

Examples of javax.websocket.CloseReason

            throws WsIOException {
        if (binaryMsgHandler instanceof WrappedMessageHandler) {
            long maxMessageSize =
                    ((WrappedMessageHandler) binaryMsgHandler).getMaxMessageSize();
            if (maxMessageSize > -1 && msg.remaining() > maxMessageSize) {
                throw new WsIOException(new CloseReason(CloseCodes.TOO_BIG,
                        sm.getString("wsFrame.messageTooBig",
                                Long.valueOf(msg.remaining()),
                                Long.valueOf(maxMessageSize))));
            }
        }
View Full Code Here

Examples of javax.websocket.CloseReason

     * Cleans up the resources still in use by WebSocket sessions created from
     * this container. This includes closing sessions and cancelling
     * {@link Future}s associated with blocking read/writes.
     */
    public void destroy() {
        CloseReason cr = new CloseReason(
                CloseCodes.GOING_AWAY, sm.getString("wsWebSocketContainer.shutdown"));

        for (WsSession session : sessions.keySet()) {
            try {
                session.close(cr);
View Full Code Here

Examples of javax.websocket.CloseReason

    private void closeConnection(Session session, GuacamoleStatus guac_status) {

        try {
            CloseCode code = CloseReason.CloseCodes.getCloseCode(guac_status.getWebSocketCode());
            String message = Integer.toString(guac_status.getGuacamoleStatusCode());
            session.close(new CloseReason(code, message));
        }
        catch (IOException e) {
            logger.debug("Unable to close WebSocket connection.", e);
        }
View Full Code Here

Examples of javax.websocket.CloseReason

     * Cleans up the resources still in use by WebSocket sessions created from
     * this container. This includes closing sessions and cancelling
     * {@link Future}s associated with blocking read/writes.
     */
    public void destroy() {
        CloseReason cr = new CloseReason(
                CloseCodes.GOING_AWAY, sm.getString("wsWebSocketContainer.shutdown"));

        for (WsSession session : sessions.keySet()) {
            try {
                session.close(cr);
View Full Code Here

Examples of javax.websocket.CloseReason

        return sessionId;
    }

    @Override
    public void close() throws IOException {
        close(new CloseReason(CloseReason.CloseCodes.NORMAL_CLOSURE, null));
    }
View Full Code Here

Examples of javax.websocket.CloseReason

                        }
                    }
                } finally {
                    try {
                        if (closeReason == null) {
                            endpoint.getInstance().onClose(this, new CloseReason(CloseReason.CloseCodes.NO_STATUS_CODE, null));
                        } else {
                            endpoint.getInstance().onClose(this, closeReason);
                        }
                    } catch (Exception e) {
                        endpoint.getInstance().onError(this, e);
View Full Code Here

Examples of javax.websocket.CloseReason

                WebSockets.sendClose(toSend, channel, null);
                try {
                    if (singleBuffer.remaining() > 1) {
                        final CloseReason.CloseCode code = CloseReason.CloseCodes.getCloseCode(singleBuffer.getShort());
                        final String reasonPhrase = singleBuffer.remaining() > 1 ? new UTF8Output(singleBuffer).extract() : null;
                        session.close(new CloseReason(code, reasonPhrase));
                    } else {
                        session.close();
                    }
                } catch (IOException e) {
                    invokeOnError(e);
View Full Code Here

Examples of javax.websocket.CloseReason

    @Override
    public synchronized void close() {
        for (ConfiguredServerEndpoint endpoint : configuredServerEndpoints) {
            for (Session session : endpoint.getOpenSessions()) {
                try {
                    session.close(new CloseReason(CloseReason.CloseCodes.GOING_AWAY, ""));
                } catch (Exception e) {
                    JsrWebSocketLogger.ROOT_LOGGER.couldNotCloseOnUndeploy(e);
                }
            }
        }
View Full Code Here

Examples of javax.websocket.CloseReason

  {
    if (isOpen())
    {
      try
      {
        session.close(new CloseReason(new CloseCode(code), reason));
      } catch (IOException iox)
      {
        LOG.error("An error occurred while closing WebSocket session", iox);
      }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.