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.WebSocket
A 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 SocketSet
remoteSocketSet
-
Constructor Summary
Constructors Constructor Description MockWebSocket()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
abort()
java.lang.String
getSubprotocol()
void
init(SocketSet otherSide)
boolean
isInputClosed()
boolean
isOutputClosed()
void
request(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:
sendText
in interfacejava.net.http.WebSocket
-
sendBinary
public java.util.concurrent.CompletableFuture<java.net.http.WebSocket> sendBinary(java.nio.ByteBuffer data, boolean last)
- Specified by:
sendBinary
in interfacejava.net.http.WebSocket
-
sendPing
public java.util.concurrent.CompletableFuture<java.net.http.WebSocket> sendPing(java.nio.ByteBuffer message)
- Specified by:
sendPing
in interfacejava.net.http.WebSocket
-
sendPong
public java.util.concurrent.CompletableFuture<java.net.http.WebSocket> sendPong(java.nio.ByteBuffer message)
- Specified by:
sendPong
in interfacejava.net.http.WebSocket
-
sendClose
public java.util.concurrent.CompletableFuture<java.net.http.WebSocket> sendClose(int statusCode, java.lang.String reason)
- Specified by:
sendClose
in interfacejava.net.http.WebSocket
-
request
public void request(long n)
- Specified by:
request
in interfacejava.net.http.WebSocket
-
getSubprotocol
public java.lang.String getSubprotocol()
- Specified by:
getSubprotocol
in interfacejava.net.http.WebSocket
-
isOutputClosed
public boolean isOutputClosed()
- Specified by:
isOutputClosed
in interfacejava.net.http.WebSocket
-
isInputClosed
public boolean isInputClosed()
- Specified by:
isInputClosed
in interfacejava.net.http.WebSocket
-
abort
public void abort()
- Specified by:
abort
in interfacejava.net.http.WebSocket
-
init
public void init(SocketSet otherSide)
-
-