Package kong.unirest.core
Class MockWebSocket
- java.lang.Object
-
- kong.unirest.core.MockWebSocket
-
- All Implemented Interfaces:
java.net.http.WebSocket
public class MockWebSocket extends java.lang.Object implements java.net.http.WebSocketA Mock of a websocket that sends messages directly to a single listener on the other side
-
-
Field Summary
Fields Modifier and Type Field Description private SocketSetremoteSocketSet
-
Constructor Summary
Constructors Constructor Description MockWebSocket()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidabort()java.lang.StringgetSubprotocol()voidinit(SocketSet otherSide)booleanisInputClosed()booleanisOutputClosed()voidrequest(long n)java.util.concurrent.CompletableFuture<java.net.http.WebSocket>sendBinary(java.nio.ByteBuffer data, boolean last)java.util.concurrent.CompletableFuture<java.net.http.WebSocket>sendClose(int statusCode, java.lang.String reason)java.util.concurrent.CompletableFuture<java.net.http.WebSocket>sendPing(java.nio.ByteBuffer message)java.util.concurrent.CompletableFuture<java.net.http.WebSocket>sendPong(java.nio.ByteBuffer message)java.util.concurrent.CompletableFuture<java.net.http.WebSocket>sendText(java.lang.CharSequence data, boolean last)private java.util.concurrent.CompletableFuture<java.net.http.WebSocket>sendToOtherSide(java.util.function.BiConsumer<java.net.http.WebSocket,java.net.http.WebSocket.Listener> consumer)
-
-
-
Field Detail
-
remoteSocketSet
private SocketSet remoteSocketSet
-
-
Method Detail
-
sendToOtherSide
private java.util.concurrent.CompletableFuture<java.net.http.WebSocket> sendToOtherSide(java.util.function.BiConsumer<java.net.http.WebSocket,java.net.http.WebSocket.Listener> consumer)
-
sendText
public java.util.concurrent.CompletableFuture<java.net.http.WebSocket> sendText(java.lang.CharSequence data, boolean last)- Specified by:
sendTextin interfacejava.net.http.WebSocket
-
sendBinary
public java.util.concurrent.CompletableFuture<java.net.http.WebSocket> sendBinary(java.nio.ByteBuffer data, boolean last)- Specified by:
sendBinaryin interfacejava.net.http.WebSocket
-
sendPing
public java.util.concurrent.CompletableFuture<java.net.http.WebSocket> sendPing(java.nio.ByteBuffer message)
- Specified by:
sendPingin interfacejava.net.http.WebSocket
-
sendPong
public java.util.concurrent.CompletableFuture<java.net.http.WebSocket> sendPong(java.nio.ByteBuffer message)
- Specified by:
sendPongin interfacejava.net.http.WebSocket
-
sendClose
public java.util.concurrent.CompletableFuture<java.net.http.WebSocket> sendClose(int statusCode, java.lang.String reason)- Specified by:
sendClosein interfacejava.net.http.WebSocket
-
request
public void request(long n)
- Specified by:
requestin interfacejava.net.http.WebSocket
-
getSubprotocol
public java.lang.String getSubprotocol()
- Specified by:
getSubprotocolin interfacejava.net.http.WebSocket
-
isOutputClosed
public boolean isOutputClosed()
- Specified by:
isOutputClosedin interfacejava.net.http.WebSocket
-
isInputClosed
public boolean isInputClosed()
- Specified by:
isInputClosedin interfacejava.net.http.WebSocket
-
abort
public void abort()
- Specified by:
abortin interfacejava.net.http.WebSocket
-
init
public void init(SocketSet otherSide)
-
-