Enum WebSocketError
- All Implemented Interfaces:
Serializable
,Comparable<WebSocketError>
- See Also:
-
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionCompression failed.A non-control frame was detected although the existing continuation had not been closed.Decompression failed.The value inSec-WebSocket-Extensions
failed to be parsed.The combination of the extensions contained inSec-WebSocket-Extensions
header causes conflicts.Flushing frames to the server failed.A control frame is fragmented.A frame from the server is masked.The certificate of the peer does not match the expected hostname.An error occurred while HTTP header section was being read.The end of the stream has been reached unexpectedly.OutOfMemoryError
occurred during a trial to allocate a memory area for a frame's payload.Interruption occurred while a frame was being read from the WebSocket.The payload length of a frame is invalid.An I/O error occurred while a frame was being read from the WebSocket.An I/O error occurred when a frame was tried to be sent.Failed to concatenate payloads of multiple frames to construct a message.The opening handshake response does not containConnection
header.No more frame can be read because the end of the input stream has been reached.The opening handshake response does not containSec-WebSocket-Accept
header.The opening handshake response does not containUpgrade
header.Upgrade
was not found inConnection
header.websocket
was not found inUpgrade
header.At least one of the reserved bits of a frame is set.The current state of the WebSocket is not CREATED.The status code of the opening handshake response is not101 Switching Protocols
.Failed to send an opening handshake request to the server.Failed to read an opening handshake response from the server.The value ofserver_max_window_bits
parameter orclient_max_window_bits
parameter ofpermessage-deflate
extension is invalid.permessage-deflate
extension contains an unsupported parameter.Handshake with a proxy server failed.Socket.connect()
failed.Failed to get the input stream of the raw socket.Failed to get the output stream of the raw socket.Failed to overlay an existing socket.SSL handshake with a WebSocket endpoint failed.The status line of the opening handshake response is badly formatted.The status line of the opening handshake response is empty.Failed to convert payload data into a string.The payload size of a control frame exceeds the maximum size (125 bytes).The payload length of a frame exceeds the maximum array size in Java.A continuation frame was detected although a continuation had not started.An uncaught throwable was detected in the reading thread (which reads frames from the server).An uncaught throwable was detected in the writing thread (which sends frames to the server).A reserved bit of a frame has an unexpected value.The value ofSec-WebSocket-Accept
header is different from the expected one.A frame has an unknown opcode.The extension contained inSec-WebSocket-Extensions
header is not supported.The protocol contained inSec-WebSocket-Protocol
header is not supported. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic WebSocketError
Returns the enum constant of this type with the specified name.static WebSocketError[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
Enum Constant Details
-
NOT_IN_CREATED_STATE
The current state of the WebSocket is not CREATED.This error occurs if
WebSocket.connect()
is called when the state of the WebSocket is notCREATED
. -
SOCKET_INPUT_STREAM_FAILURE
Failed to get the input stream of the raw socket. -
SOCKET_OUTPUT_STREAM_FAILURE
Failed to get the output stream of the raw socket. -
OPENING_HAHDSHAKE_REQUEST_FAILURE
Failed to send an opening handshake request to the server. -
OPENING_HANDSHAKE_RESPONSE_FAILURE
Failed to read an opening handshake response from the server. -
STATUS_LINE_EMPTY
The status line of the opening handshake response is empty. -
STATUS_LINE_BAD_FORMAT
The status line of the opening handshake response is badly formatted. -
NOT_SWITCHING_PROTOCOLS
The status code of the opening handshake response is not101 Switching Protocols
. -
HTTP_HEADER_FAILURE
An error occurred while HTTP header section was being read. -
NO_UPGRADE_HEADER
The opening handshake response does not containUpgrade
header. -
NO_WEBSOCKET_IN_UPGRADE_HEADER
websocket
was not found inUpgrade
header. -
NO_CONNECTION_HEADER
The opening handshake response does not containConnection
header. -
NO_UPGRADE_IN_CONNECTION_HEADER
Upgrade
was not found inConnection
header. -
NO_SEC_WEBSOCKET_ACCEPT_HEADER
The opening handshake response does not containSec-WebSocket-Accept
header. -
UNEXPECTED_SEC_WEBSOCKET_ACCEPT_HEADER
The value ofSec-WebSocket-Accept
header is different from the expected one. -
EXTENSION_PARSE_ERROR
The value inSec-WebSocket-Extensions
failed to be parsed. -
UNSUPPORTED_EXTENSION
The extension contained inSec-WebSocket-Extensions
header is not supported. -
EXTENSIONS_CONFLICT
The combination of the extensions contained inSec-WebSocket-Extensions
header causes conflicts.- Since:
- 1.15
-
UNSUPPORTED_PROTOCOL
The protocol contained inSec-WebSocket-Protocol
header is not supported. -
INSUFFICENT_DATA
The end of the stream has been reached unexpectedly. -
INVALID_PAYLOAD_LENGTH
The payload length of a frame is invalid. -
TOO_LONG_PAYLOAD
The payload length of a frame exceeds the maximum array size in Java. -
INSUFFICIENT_MEMORY_FOR_PAYLOAD
OutOfMemoryError
occurred during a trial to allocate a memory area for a frame's payload. -
INTERRUPTED_IN_READING
Interruption occurred while a frame was being read from the WebSocket. -
IO_ERROR_IN_READING
An I/O error occurred while a frame was being read from the WebSocket. -
IO_ERROR_IN_WRITING
An I/O error occurred when a frame was tried to be sent. -
FLUSH_ERROR
Flushing frames to the server failed. -
NON_ZERO_RESERVED_BITS
At least one of the reserved bits of a frame is set.From RFC 6455, 5.2 Base Framing Protocol; RSV1, RSV2, RSV3:
MUST be 0 unless an extension is negotiated that defines meanings for non-zero values. If a nonzero value is received and none of the negotiated extensions defines the meaning of such a nonzero value, the receiving endpoint MUST Fail the WebSocket Connection.
By calling
WebSocket.setExtended
(true)
, you can skip the validity check of the RSV1/RSV2/RSV3 bits.This error code is not used in version 1.15 and after.
-
UNEXPECTED_RESERVED_BIT
A reserved bit of a frame has an unexpected value.From RFC 6455, 5.2 Base Framing Protocol; RSV1, RSV2, RSV3:
MUST be 0 unless an extension is negotiated that defines meanings for non-zero values. If a nonzero value is received and none of the negotiated extensions defines the meaning of such a nonzero value, the receiving endpoint MUST Fail the WebSocket Connection.
By calling
WebSocket.setExtended
(true)
, you can skip the validity check of the RSV1/RSV2/RSV3 bits.- Since:
- 1.15
-
FRAME_MASKED
A frame from the server is masked.From RFC 6455, 5.1. Overview:
A server MUST NOT mask any frames that it sends to the client. A client MUST close a connection if it detects a masked frame.
-
UNKNOWN_OPCODE
A frame has an unknown opcode.By calling
WebSocket.setExtended
(true)
, you can accept frames which have an unknown opcode. -
FRAGMENTED_CONTROL_FRAME
A control frame is fragmented.From RFC 6455, 5.4. Fragmentation:
Control frames (see Section 5.5) MAY be injected in the middle of a fragmented message. Control frames themselves MUST NOT be fragmented.
-
UNEXPECTED_CONTINUATION_FRAME
A continuation frame was detected although a continuation had not started. -
CONTINUATION_NOT_CLOSED
A non-control frame was detected although the existing continuation had not been closed. -
TOO_LONG_CONTROL_FRAME_PAYLOAD
The payload size of a control frame exceeds the maximum size (125 bytes).From RFC 6455, 5.5. Control Frames:
All control frames MUST have a payload length of 125 bytes or less and MUST NOT be fragmented.
-
MESSAGE_CONSTRUCTION_ERROR
Failed to concatenate payloads of multiple frames to construct a message. -
TEXT_MESSAGE_CONSTRUCTION_ERROR
Failed to convert payload data into a string. -
UNEXPECTED_ERROR_IN_READING_THREAD
An uncaught throwable was detected in the reading thread (which reads frames from the server). -
UNEXPECTED_ERROR_IN_WRITING_THREAD
An uncaught throwable was detected in the writing thread (which sends frames to the server). -
PERMESSAGE_DEFLATE_UNSUPPORTED_PARAMETER
permessage-deflate
extension contains an unsupported parameter.See 7. The "permessage-deflate" Extension in RFC 7692 for details.
- Since:
- 1.15
-
PERMESSAGE_DEFLATE_INVALID_MAX_WINDOW_BITS
The value ofserver_max_window_bits
parameter orclient_max_window_bits
parameter ofpermessage-deflate
extension is invalid.See 7.1.2. Limiting the LZ77 Sliding Window Size in RFC 7692 for details.
- Since:
- 1.15
-
COMPRESSION_ERROR
Compression failed.- Since:
- 1.17
-
DECOMPRESSION_ERROR
Decompression failed.- Since:
- 1.16
-
SOCKET_CONNECT_ERROR
Socket.connect()
failed.- Since:
- 1.20
-
PROXY_HANDSHAKE_ERROR
Handshake with a proxy server failed.- Since:
- 1.20
-
SOCKET_OVERLAY_ERROR
Failed to overlay an existing socket.- Since:
- 1.20
-
SSL_HANDSHAKE_ERROR
SSL handshake with a WebSocket endpoint failed.- Since:
- 1.20
-
NO_MORE_FRAME
No more frame can be read because the end of the input stream has been reached.This happens when the WebSocket connection is closed without receiving a close frame from the WebSocket server. Strictly speaking, it is a violation against RFC 6455, but it seems some server implementations sometimes close a connection without sending a close frame.
- Since:
- 1.29
-
HOSTNAME_UNVERIFIED
The certificate of the peer does not match the expected hostname.When
WebSocketException.getError()
returns this error code, theWebSocketException
can be cast toHostnameUnverifiedException
through which you can get theSee Verify that certificate is valid for server hostname (#107).
- Since:
- 2.1
-
-
Constructor Details
-
WebSocketError
private WebSocketError()
-
-
Method Details
-
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
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 nameNullPointerException
- if the argument is null
-