@@ -112,6 +112,31 @@ public class CloseFrame extends ControlFrame {
112112 * fulfilling the request.
113113 **/
114114 public static final int UNEXPECTED_CONDITION = 1011 ;
115+ /**
116+ * 1012 indicates that the service is restarted.
117+ * A client may reconnect, and if it choses to do, should reconnect using a randomized delay of 5 - 30s.
118+ * See https://www.ietf.org/mail-archive/web/hybi/current/msg09670.html for more information.
119+ *
120+ * @since 1.3.8
121+ **/
122+ public static final int SERVICE_RESTART = 1012 ;
123+ /**
124+ * 1013 indicates that the service is experiencing overload.
125+ * A client should only connect to a different IP (when there are multiple for the target)
126+ * or reconnect to the same IP upon user action.
127+ * See https://www.ietf.org/mail-archive/web/hybi/current/msg09670.html for more information.
128+ *
129+ * @since 1.3.8
130+ **/
131+ public static final int TRY_AGAIN_LATER = 1013 ;
132+ /**
133+ * 1014 indicates that the server was acting as a gateway or proxy and received an
134+ * invalid response from the upstream server. This is similar to 502 HTTP Status Code
135+ * See https://www.ietf.org/mail-archive/web/hybi/current/msg10748.html fore more information.
136+ *
137+ * @since 1.3.8
138+ **/
139+ public static final int BAD_GATEWAY = 1014 ;
115140 /**
116141 * 1015 is a reserved value and MUST NOT be set as a status code in a
117142 * Close control frame by an endpoint. It is designated for use in
@@ -216,7 +241,7 @@ public void isValid() throws InvalidDataException {
216241 throw new InvalidDataException (PROTOCOL_ERROR , "A close frame must have a closecode if it has a reason" );
217242 }
218243 //Intentional check for code != CloseFrame.TLS_ERROR just to make sure even if the code earlier changes
219- if ((code > CloseFrame .UNEXPECTED_CONDITION && code < 3000 && code != CloseFrame . TLS_ERROR )) {
244+ if ((code > CloseFrame .TLS_ERROR && code < 3000 )) {
220245 throw new InvalidDataException (PROTOCOL_ERROR , "Trying to send an illegal close code!" );
221246 }
222247 if (code == CloseFrame .ABNORMAL_CLOSE || code == CloseFrame .TLS_ERROR || code == CloseFrame .NOCODE || code > 4999 || code < 1000 || code == 1004 ) {
0 commit comments