Examples of WebSocketException


Examples of cz.woitee.websockets.WebSocketException

    WebSocketFrame readResult;
    do {
      readResult = WebSocketFrame.readFrame(in);
      if (readResult.bytesRead == -1) { return -1; }
      if (readResult.masked == false) {
        throw new WebSocketException("Received an unmasked frame from client.");
      }
      if (readResult.opcode == 0x8) {
        throw new WebSocketException("The opposite side closed the WebSocket connection.");
      }
      ping = readResult.opcode == 0x9;
      if (ping) {
        //automatically form ping response (pong)
        byte[] appData = readResult.bytes;
View Full Code Here

Examples of org.eclipse.jetty.websocket.api.WebSocketException

        EventDriver driver = wrap(socket);

        try (LocalWebSocketSession conn = new LocalWebSocketSession(testname,driver,bufferPool))
        {
            conn.open();
            driver.incomingError(new WebSocketException("oof"));
            driver.incomingFrame(new CloseInfo(StatusCode.NORMAL).asFrame());

            socket.capture.assertEventCount(3);
            socket.capture.pop().assertEventStartsWith("onConnect");
            socket.capture.pop().assertEventStartsWith("onError(WebSocketException: oof)");
View Full Code Here

Examples of org.eclipse.jetty.websocket.api.WebSocketException

        }

        @Override
        public void run()
        {
            failed(new WebSocketException("MUX Not yet supported"));
        }
View Full Code Here

Examples of org.eclipse.jetty.websocket.api.WebSocketException

    @Override
    public Object createWebSocket(ServletUpgradeRequest req, ServletUpgradeResponse resp)
    {
        if (registeredSocketClasses.size() < 1)
        {
            throw new WebSocketException("No WebSockets have been registered with the factory.  Cannot use default implementation of WebSocketCreator.");
        }

        if (registeredSocketClasses.size() > 1)
        {
            LOG.warn("You have registered more than 1 websocket object, and are using the default WebSocketCreator! Using first registered websocket.");
        }

        Class<?> firstClass = registeredSocketClasses.get(0);
        try
        {
            return firstClass.newInstance();
        }
        catch (InstantiationException | IllegalAccessException e)
        {
            throw new WebSocketException("Unable to create instance of " + firstClass, e);
        }
    }
View Full Code Here

Examples of org.eclipse.jetty.websocket.api.WebSocketException

            this.method.invoke(obj,args);
        }
        catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e)
        {
            String err = String.format("Cannot call method %s on %s with args: %s",method,pojo, QuoteUtil.join(args,","));
            throw new WebSocketException(err,e);
        }
    }
View Full Code Here

Examples of org.eclipse.jetty.websocket.api.WebSocketException

                }
                delim = true;
            }
            err.append("]");

            throw new WebSocketException(err.toString(),e);
        }
    }
View Full Code Here

Examples of org.eclipse.jetty.websocket.api.WebSocketException

            Object obj = binaryDecoder.decode(BufferUtil.toBuffer(data));
            wholeHandler.onMessage(obj);
        }
        catch (DecodeException e)
        {
            throw new WebSocketException("Unable to decode binary data",e);
        }
    }
View Full Code Here

Examples of org.eclipse.jetty.websocket.api.WebSocketException

            Object obj = textDecoder.decode(utf.toString());
            wholeHandler.onMessage(obj);
        }
        catch (DecodeException e)
        {
            throw new WebSocketException("Unable to decode text data",e);
        }
    }
View Full Code Here

Examples of org.eclipse.jetty.websocket.api.WebSocketException

            notifyWebSocketException(e);
        }
        catch (Throwable t)
        {
            LOG.warn(t);
            notifyWebSocketException(new WebSocketException(t));
        }
    }
View Full Code Here

Examples of org.eclipse.jetty.websocket.api.WebSocketException

        catch (Throwable t)
        {
            buffer.position(buffer.limit()); // consume remaining
            reset();
            // let session know
            WebSocketException e = new WebSocketException(t);
            notifyWebSocketException(e);
            // need to throw for proper close behavior in connection
            throw e;
        }
    }
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.