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;