Java Code Examples for javax.websocket.CloseReason.CloseCodes#CANNOT_ACCEPT

The following examples show how to use javax.websocket.CloseReason.CloseCodes#CANNOT_ACCEPT . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Util.java    From Tomcat8-Source-Read with MIT License 4 votes vote down vote up
static CloseCode getCloseCode(int code) {
    if (code > 2999 && code < 5000) {
        return CloseCodes.getCloseCode(code);
    }
    switch (code) {
        case 1000:
            return CloseCodes.NORMAL_CLOSURE;
        case 1001:
            return CloseCodes.GOING_AWAY;
        case 1002:
            return CloseCodes.PROTOCOL_ERROR;
        case 1003:
            return CloseCodes.CANNOT_ACCEPT;
        case 1004:
            // Should not be used in a close frame
            // return CloseCodes.RESERVED;
            return CloseCodes.PROTOCOL_ERROR;
        case 1005:
            // Should not be used in a close frame
            // return CloseCodes.NO_STATUS_CODE;
            return CloseCodes.PROTOCOL_ERROR;
        case 1006:
            // Should not be used in a close frame
            // return CloseCodes.CLOSED_ABNORMALLY;
            return CloseCodes.PROTOCOL_ERROR;
        case 1007:
            return CloseCodes.NOT_CONSISTENT;
        case 1008:
            return CloseCodes.VIOLATED_POLICY;
        case 1009:
            return CloseCodes.TOO_BIG;
        case 1010:
            return CloseCodes.NO_EXTENSION;
        case 1011:
            return CloseCodes.UNEXPECTED_CONDITION;
        case 1012:
            // Not in RFC6455
            // return CloseCodes.SERVICE_RESTART;
            return CloseCodes.PROTOCOL_ERROR;
        case 1013:
            // Not in RFC6455
            // return CloseCodes.TRY_AGAIN_LATER;
            return CloseCodes.PROTOCOL_ERROR;
        case 1015:
            // Should not be used in a close frame
            // return CloseCodes.TLS_HANDSHAKE_FAILURE;
            return CloseCodes.PROTOCOL_ERROR;
        default:
            return CloseCodes.PROTOCOL_ERROR;
    }
}
 
Example 2
Source File: Util.java    From Tomcat7.0.67 with Apache License 2.0 4 votes vote down vote up
static CloseCode getCloseCode(int code) {
    if (code > 2999 && code < 5000) {
        return CloseCodes.getCloseCode(code);
    }
    switch (code) {
        case 1000:
            return CloseCodes.NORMAL_CLOSURE;
        case 1001:
            return CloseCodes.GOING_AWAY;
        case 1002:
            return CloseCodes.PROTOCOL_ERROR;
        case 1003:
            return CloseCodes.CANNOT_ACCEPT;
        case 1004:
            // Should not be used in a close frame
            // return CloseCodes.RESERVED;
            return CloseCodes.PROTOCOL_ERROR;
        case 1005:
            // Should not be used in a close frame
            // return CloseCodes.NO_STATUS_CODE;
            return CloseCodes.PROTOCOL_ERROR;
        case 1006:
            // Should not be used in a close frame
            // return CloseCodes.CLOSED_ABNORMALLY;
            return CloseCodes.PROTOCOL_ERROR;
        case 1007:
            return CloseCodes.NOT_CONSISTENT;
        case 1008:
            return CloseCodes.VIOLATED_POLICY;
        case 1009:
            return CloseCodes.TOO_BIG;
        case 1010:
            return CloseCodes.NO_EXTENSION;
        case 1011:
            return CloseCodes.UNEXPECTED_CONDITION;
        case 1012:
            // Not in RFC6455
            // return CloseCodes.SERVICE_RESTART;
            return CloseCodes.PROTOCOL_ERROR;
        case 1013:
            // Not in RFC6455
            // return CloseCodes.TRY_AGAIN_LATER;
            return CloseCodes.PROTOCOL_ERROR;
        case 1015:
            // Should not be used in a close frame
            // return CloseCodes.TLS_HANDSHAKE_FAILURE;
            return CloseCodes.PROTOCOL_ERROR;
        default:
            return CloseCodes.PROTOCOL_ERROR;
    }
}
 
Example 3
Source File: Util.java    From tomcatsrc with Apache License 2.0 4 votes vote down vote up
static CloseCode getCloseCode(int code) {
    if (code > 2999 && code < 5000) {
        return CloseCodes.getCloseCode(code);
    }
    switch (code) {
        case 1000:
            return CloseCodes.NORMAL_CLOSURE;
        case 1001:
            return CloseCodes.GOING_AWAY;
        case 1002:
            return CloseCodes.PROTOCOL_ERROR;
        case 1003:
            return CloseCodes.CANNOT_ACCEPT;
        case 1004:
            // Should not be used in a close frame
            // return CloseCodes.RESERVED;
            return CloseCodes.PROTOCOL_ERROR;
        case 1005:
            // Should not be used in a close frame
            // return CloseCodes.NO_STATUS_CODE;
            return CloseCodes.PROTOCOL_ERROR;
        case 1006:
            // Should not be used in a close frame
            // return CloseCodes.CLOSED_ABNORMALLY;
            return CloseCodes.PROTOCOL_ERROR;
        case 1007:
            return CloseCodes.NOT_CONSISTENT;
        case 1008:
            return CloseCodes.VIOLATED_POLICY;
        case 1009:
            return CloseCodes.TOO_BIG;
        case 1010:
            return CloseCodes.NO_EXTENSION;
        case 1011:
            return CloseCodes.UNEXPECTED_CONDITION;
        case 1012:
            // Not in RFC6455
            // return CloseCodes.SERVICE_RESTART;
            return CloseCodes.PROTOCOL_ERROR;
        case 1013:
            // Not in RFC6455
            // return CloseCodes.TRY_AGAIN_LATER;
            return CloseCodes.PROTOCOL_ERROR;
        case 1015:
            // Should not be used in a close frame
            // return CloseCodes.TLS_HANDSHAKE_FAILURE;
            return CloseCodes.PROTOCOL_ERROR;
        default:
            return CloseCodes.PROTOCOL_ERROR;
    }
}