public enum WebSocketError extends Enum<WebSocketError>
WebSocketException.getError()
Enum Constant and Description |
---|
COMPRESSION_ERROR
Compression failed.
|
CONTINUATION_NOT_CLOSED
A non-control frame was detected although the existing continuation had not been closed.
|
DECOMPRESSION_ERROR
Decompression failed.
|
EXTENSION_PARSE_ERROR
The value in
Sec-WebSocket-Extensions failed to be parsed. |
EXTENSIONS_CONFLICT
The combination of the extensions contained in
Sec-WebSocket-Extensions header
causes conflicts. |
FLUSH_ERROR
Flushing frames to the server failed.
|
FRAGMENTED_CONTROL_FRAME
A control frame is fragmented.
|
FRAME_MASKED
A frame from the server is masked.
|
HOSTNAME_UNVERIFIED
The certificate of the peer does not match the expected hostname.
|
HTTP_HEADER_FAILURE
An error occurred while HTTP header section was being read.
|
INSUFFICENT_DATA
The end of the stream has been reached unexpectedly.
|
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.
|
INVALID_PAYLOAD_LENGTH
The payload length of a frame is invalid.
|
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.
|
MESSAGE_CONSTRUCTION_ERROR
Failed to concatenate payloads of multiple frames to construct a message.
|
NO_CONNECTION_HEADER
The opening handshake response does not contain
Connection header. |
NO_MORE_FRAME
No more frame can be read because the end of the input stream has been reached.
|
NO_SEC_WEBSOCKET_ACCEPT_HEADER
The opening handshake response does not contain
Sec-WebSocket-Accept header. |
NO_UPGRADE_HEADER
The opening handshake response does not contain
Upgrade header. |
NO_UPGRADE_IN_CONNECTION_HEADER
Upgrade was not found in Connection header. |
NO_WEBSOCKET_IN_UPGRADE_HEADER
websocket was not found in Upgrade header. |
NON_ZERO_RESERVED_BITS
At least one of the reserved bits of a frame is set.
|
NOT_IN_CREATED_STATE
The current state of the WebSocket is not CREATED.
|
NOT_SWITCHING_PROTOCOLS
The status code of the opening handshake response is not
101 Switching Protocols . |
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.
|
PERMESSAGE_DEFLATE_INVALID_MAX_WINDOW_BITS
The value of
server_max_window_bits parameter or client_max_window_bits parameter of permessage-deflate
extension is invalid. |
PERMESSAGE_DEFLATE_UNSUPPORTED_PARAMETER
permessage-deflate extension contains an unsupported parameter. |
PROXY_HANDSHAKE_ERROR
Handshake with a proxy server failed.
|
SOCKET_CONNECT_ERROR
Socket.connect() failed. |
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.
|
SOCKET_OVERLAY_ERROR
Failed to overlay an existing socket.
|
SSL_HANDSHAKE_ERROR
SSL handshake with a WebSocket endpoint failed.
|
STATUS_LINE_BAD_FORMAT
The status line of the opening handshake response is badly formatted.
|
STATUS_LINE_EMPTY
The status line of the opening handshake response is empty.
|
TEXT_MESSAGE_CONSTRUCTION_ERROR
Failed to convert payload data into a string.
|
TOO_LONG_CONTROL_FRAME_PAYLOAD
The payload size of a control frame exceeds the maximum size (125 bytes).
|
TOO_LONG_PAYLOAD
The payload length of a frame exceeds the maximum array size in Java.
|
UNEXPECTED_CONTINUATION_FRAME
A continuation frame was detected although a continuation had not started.
|
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).
|
UNEXPECTED_RESERVED_BIT
A reserved bit of a frame has an unexpected value.
|
UNEXPECTED_SEC_WEBSOCKET_ACCEPT_HEADER
The value of
Sec-WebSocket-Accept header is different from the expected one. |
UNKNOWN_OPCODE
A frame has an unknown opcode.
|
UNSUPPORTED_EXTENSION
The extension contained in
Sec-WebSocket-Extensions header is not supported. |
UNSUPPORTED_PROTOCOL
The protocol contained in
Sec-WebSocket-Protocol header is not supported. |
Modifier and Type | Method and Description |
---|---|
static WebSocketError |
valueOf(String name)
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.
|
public static final WebSocketError NOT_IN_CREATED_STATE
This error occurs if WebSocket.connect()
is called
when the state of the WebSocket is not CREATED
.
public static final WebSocketError SOCKET_INPUT_STREAM_FAILURE
public static final WebSocketError SOCKET_OUTPUT_STREAM_FAILURE
public static final WebSocketError OPENING_HAHDSHAKE_REQUEST_FAILURE
public static final WebSocketError OPENING_HANDSHAKE_RESPONSE_FAILURE
public static final WebSocketError STATUS_LINE_EMPTY
public static final WebSocketError STATUS_LINE_BAD_FORMAT
public static final WebSocketError NOT_SWITCHING_PROTOCOLS
101 Switching Protocols
.public static final WebSocketError HTTP_HEADER_FAILURE
public static final WebSocketError NO_UPGRADE_HEADER
Upgrade
header.public static final WebSocketError NO_WEBSOCKET_IN_UPGRADE_HEADER
websocket
was not found in Upgrade
header.public static final WebSocketError NO_CONNECTION_HEADER
Connection
header.public static final WebSocketError NO_UPGRADE_IN_CONNECTION_HEADER
Upgrade
was not found in Connection
header.public static final WebSocketError NO_SEC_WEBSOCKET_ACCEPT_HEADER
Sec-WebSocket-Accept
header.public static final WebSocketError UNEXPECTED_SEC_WEBSOCKET_ACCEPT_HEADER
Sec-WebSocket-Accept
header is different from the expected one.public static final WebSocketError EXTENSION_PARSE_ERROR
Sec-WebSocket-Extensions
failed to be parsed.public static final WebSocketError UNSUPPORTED_EXTENSION
Sec-WebSocket-Extensions
header is not supported.public static final WebSocketError EXTENSIONS_CONFLICT
Sec-WebSocket-Extensions
header
causes conflicts.public static final WebSocketError UNSUPPORTED_PROTOCOL
Sec-WebSocket-Protocol
header is not supported.public static final WebSocketError INSUFFICENT_DATA
public static final WebSocketError INVALID_PAYLOAD_LENGTH
public static final WebSocketError TOO_LONG_PAYLOAD
public static final WebSocketError INSUFFICIENT_MEMORY_FOR_PAYLOAD
OutOfMemoryError
occurred during a trial to allocate a memory area for a frame's payload.public static final WebSocketError INTERRUPTED_IN_READING
public static final WebSocketError IO_ERROR_IN_READING
public static final WebSocketError IO_ERROR_IN_WRITING
public static final WebSocketError FLUSH_ERROR
public static final WebSocketError NON_ZERO_RESERVED_BITS
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.
public static final WebSocketError UNEXPECTED_RESERVED_BIT
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.
public static final WebSocketError FRAME_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.
public static final WebSocketError UNKNOWN_OPCODE
By calling WebSocket.setExtended
(true)
, you can accept frames which have an unknown opcode.
public static final WebSocketError FRAGMENTED_CONTROL_FRAME
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.
public static final WebSocketError UNEXPECTED_CONTINUATION_FRAME
public static final WebSocketError CONTINUATION_NOT_CLOSED
public static final WebSocketError TOO_LONG_CONTROL_FRAME_PAYLOAD
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.
public static final WebSocketError MESSAGE_CONSTRUCTION_ERROR
public static final WebSocketError TEXT_MESSAGE_CONSTRUCTION_ERROR
public static final WebSocketError UNEXPECTED_ERROR_IN_READING_THREAD
public static final WebSocketError UNEXPECTED_ERROR_IN_WRITING_THREAD
public static final WebSocketError PERMESSAGE_DEFLATE_UNSUPPORTED_PARAMETER
permessage-deflate
extension contains an unsupported parameter.
See 7. The "permessage-deflate" Extension in RFC 7692 for details.
public static final WebSocketError PERMESSAGE_DEFLATE_INVALID_MAX_WINDOW_BITS
server_max_window_bits
parameter or client_max_window_bits
parameter of permessage-deflate
extension is invalid.
See 7.1.2. Limiting the LZ77 Sliding Window Size in RFC 7692 for details.
public static final WebSocketError COMPRESSION_ERROR
public static final WebSocketError DECOMPRESSION_ERROR
public static final WebSocketError SOCKET_CONNECT_ERROR
Socket.connect()
failed.public static final WebSocketError PROXY_HANDSHAKE_ERROR
public static final WebSocketError SOCKET_OVERLAY_ERROR
public static final WebSocketError SSL_HANDSHAKE_ERROR
public static final WebSocketError NO_MORE_FRAME
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.
public static final WebSocketError HOSTNAME_UNVERIFIED
When WebSocketException.getError()
returns this error code, the
WebSocketException
can be cast to HostnameUnverifiedException
through which you can get the
See Verify that certificate is valid for server hostname (#107).
public static WebSocketError[] values()
for (WebSocketError c : WebSocketError.values()) System.out.println(c);
public static WebSocketError valueOf(String name)
name
- the name of the enum constant to be returned.IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is nullCopyright © 2021. All rights reserved.