Package org.glassfish.tyrus.core

Examples of org.glassfish.tyrus.core.ProtocolException


            case 0x09:
                return new PingFrame(frame);
            case 0x0A:
                return new PongFrame(frame);
            default:
                throw new ProtocolException(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 ProtocolException("Closing wrappedFrame payload, if present, must be a minimum of 2 bytes in length") {

                private static final long serialVersionUID = -5720682492584668231L;

                // autobahn test suite, test 7.3.1
                @Override
                public CloseReason getCloseReason() {
                    if (data.length == 0) {
                        return CloseReasons.NORMAL_CLOSURE.getCloseReason();
                    } else {
                        return super.getCloseReason();
                    }

                }
            };
        } else {
            closeCode = (int) Utils.toLong(data, 0, 2);
            if (closeCode < 1000 || closeCode == 1004 || closeCode == 1005 || closeCode == 1006 || (closeCode > 1013 && closeCode < 3000) || closeCode > 4999) {
                throw new ProtocolException("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.ProtocolException

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.