Enum CloseCode

java.lang.Object
java.lang.Enum<CloseCode>
org.simpleframework.http.socket.CloseCode
All Implemented Interfaces:
Serializable, Comparable<CloseCode>, java.lang.constant.Constable

public enum CloseCode extends Enum<CloseCode>
The CloseCode enumerates the closure codes specified in RFC 6455. When closing an established connection an endpoint may indicate a reason for closure. The interpretation of this reason by an endpoint, and the action an endpoint should take given this reason, are left undefined by RFC 6455. The specification defines a set of status codes and specifies which ranges may be used by extensions, frameworks, and end applications. The status code and any associated textual message are optional components of a Close frame.
  • Nested Class Summary

    Nested classes/interfaces inherited from class java.lang.Enum

    Enum.EnumDesc<E extends Enum<E>>
  • Enum Constant Summary

    Enum Constants
    Enum Constant
    Description
    Indicates an abnormal closure and should not be used.
    Indicates that the server is going down or the client browsed away.
    Indicates an unexpected error within the server.
    Indicates that a payload was not consistent with the message type.
    Indicates that the server did not negotiate an extension properly.
    Indicates that no status code was present and should not be used.
    Indicates the purpose for the connection has been fulfilled.
    Indicates an endpoint received a message that violates its policy.
    Indicates the connection is terminating due to a protocol error.
    According to RFC 6455 this has been reserved for future use.
    Indicates a validation failure for TLS and should not be used.
    Indicates that a payload is too big to be processed.
    Indicates the connection received a data type it cannot accept.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    final int
    This is the actual integer value representing the code.
    final int
    This is the high order byte for the closure code.
    final int
    This is the low order byte for the closure code.
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    private
    CloseCode(int code)
    Constructor for the CloseCode object.
  • Method Summary

    Modifier and Type
    Method
    Description
    byte[]
    This is the data that represents the closure code.
    static CloseCode
    resolveCode(int high, int low)
     
    static CloseCode
    Returns the enum constant of this type with the specified name.
    static CloseCode[]
    Returns an array containing the constants of this enum type, in the order they are declared.

    Methods inherited from class java.lang.Object

    getClass, notify, notifyAll, wait, wait, wait
  • Enum Constant Details

    • NORMAL_CLOSURE

      public static final CloseCode NORMAL_CLOSURE
      Indicates the purpose for the connection has been fulfilled.
    • GOING_AWAY

      public static final CloseCode GOING_AWAY
      Indicates that the server is going down or the client browsed away.
    • PROTOCOL_ERROR

      public static final CloseCode PROTOCOL_ERROR
      Indicates the connection is terminating due to a protocol error.
    • UNSUPPORTED_DATA

      public static final CloseCode UNSUPPORTED_DATA
      Indicates the connection received a data type it cannot accept.
    • RESERVED

      public static final CloseCode RESERVED
      According to RFC 6455 this has been reserved for future use.
    • NO_STATUS_CODE

      public static final CloseCode NO_STATUS_CODE
      Indicates that no status code was present and should not be used.
    • ABNORMAL_CLOSURE

      public static final CloseCode ABNORMAL_CLOSURE
      Indicates an abnormal closure and should not be used.
    • INVALID_FRAME_DATA

      public static final CloseCode INVALID_FRAME_DATA
      Indicates that a payload was not consistent with the message type.
    • POLICY_VIOLATION

      public static final CloseCode POLICY_VIOLATION
      Indicates an endpoint received a message that violates its policy.
    • TOO_BIG

      public static final CloseCode TOO_BIG
      Indicates that a payload is too big to be processed.
    • NO_EXTENSION

      public static final CloseCode NO_EXTENSION
      Indicates that the server did not negotiate an extension properly.
    • INTERNAL_SERVER_ERROR

      public static final CloseCode INTERNAL_SERVER_ERROR
      Indicates an unexpected error within the server.
    • TLS_HANDSHAKE_FAILURE

      public static final CloseCode TLS_HANDSHAKE_FAILURE
      Indicates a validation failure for TLS and should not be used.
  • Field Details

    • code

      public final int code
      This is the actual integer value representing the code.
    • high

      public final int high
      This is the high order byte for the closure code.
    • low

      public final int low
      This is the low order byte for the closure code.
  • Constructor Details

    • CloseCode

      private CloseCode(int code)
      Constructor for the CloseCode object. This is used to create a closure code using one of the pre-defined values within RFC 6455.
      Parameters:
      code - this is the code that is to be used
  • Method Details

    • values

      public static CloseCode[] values()
      Returns an array containing the constants of this enum type, in the order they are declared.
      Returns:
      an array containing the constants of this enum type, in the order they are declared
    • valueOf

      public static CloseCode valueOf(String name)
      Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum type has no constant with the specified name
      NullPointerException - if the argument is null
    • getData

      public byte[] getData()
      This is the data that represents the closure code. The array contains the high order byte and the low order byte as taken from the pre-defined closure code.
      Returns:
      a byte array representing the closure code
    • resolveCode

      public static CloseCode resolveCode(int high, int low)