Package org.glassfish.tyrus.core

Examples of org.glassfish.tyrus.core.ProtocolError


            case 0x09:
                return new PingFrame(frame);
            case 0x0A:
                return new PongFrame(frame);
            default:
                throw new ProtocolError(String.format("Unknown wrappedFrame type: %s",
                        Integer.toHexString(frame.getOpcode()).toUpperCase(Locale.US)));
        }
    }
View Full Code Here


        int closeCode;
        String closeReasonString;
        final byte[] data = frame.getPayloadData();
        if (data.length < 2) {
            throw new ProtocolError("Closing wrappedFrame payload, if present, must be a minimum of 2 bytes in length") {

                // autobahn test suite, test 7.3.1
                @Override
                public int getClosingCode() {
                    if (data.length == 0) {
                        return 1000;
                    } else {
                        return super.getClosingCode();
                    }
                }
            };
        } else {
            closeCode = (int) Utils.toLong(data, 0, 2);
            if (closeCode < 1000 || closeCode == 1004 || closeCode == 1005 || closeCode == 1006 || (closeCode > 1011 && closeCode < 3000) || closeCode > 4999) {
                throw new ProtocolError("Illegal status code: " + closeCode);
            }
            if (data.length > 2) {
                closeReasonString = utf8Decode(data);
            } else {
                closeReasonString = null;
View Full Code Here

TOP

Related Classes of org.glassfish.tyrus.core.ProtocolError

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.