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 TypeMethodDescriptionvoidabort()voidbooleanbooleanvoidrequest(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:
sendBinaryin interfaceWebSocket
-
sendPing
-
sendPong
-
sendClose
-
request
public void request(long n) -
getSubprotocol
- Specified by:
getSubprotocolin interfaceWebSocket
-
isOutputClosed
public boolean isOutputClosed()- Specified by:
isOutputClosedin interfaceWebSocket
-
isInputClosed
public boolean isInputClosed()- Specified by:
isInputClosedin interfaceWebSocket
-
abort
public void abort() -
init
-