Package kong.unirest.core
Class MockWebSocket
java.lang.Object
kong.unirest.core.MockWebSocket
- All Implemented Interfaces:
WebSocket
A Mock of a websocket that sends messages directly to a single listener on the other side
-
Nested Class Summary
Nested classes/interfaces inherited from interface java.net.http.WebSocket
WebSocket.Builder, WebSocket.Listener
-
Field Summary
FieldsFields inherited from interface java.net.http.WebSocket
NORMAL_CLOSURE
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
abort()
void
boolean
boolean
void
request
(long n) sendBinary
(ByteBuffer data, boolean last) sendPing
(ByteBuffer message) sendPong
(ByteBuffer message) sendText
(CharSequence data, boolean last) private CompletableFuture
<WebSocket> sendToOtherSide
(BiConsumer<WebSocket, WebSocket.Listener> consumer)
-
Field Details
-
remoteSocketSet
-
-
Constructor Details
-
MockWebSocket
public MockWebSocket()
-
-
Method Details
-
sendToOtherSide
private CompletableFuture<WebSocket> sendToOtherSide(BiConsumer<WebSocket, WebSocket.Listener> consumer) -
sendText
-
sendBinary
- Specified by:
sendBinary
in interfaceWebSocket
-
sendPing
-
sendPong
-
sendClose
-
request
public void request(long n) -
getSubprotocol
- Specified by:
getSubprotocol
in interfaceWebSocket
-
isOutputClosed
public boolean isOutputClosed()- Specified by:
isOutputClosed
in interfaceWebSocket
-
isInputClosed
public boolean isInputClosed()- Specified by:
isInputClosed
in interfaceWebSocket
-
abort
public void abort() -
init
-