java.lang.Object
io.jooby.test.MockWebSocketClient
Websocket client for unit tests.
-
Method Summary
Modifier and TypeMethodDescriptionclose()
Close a websocket and send a close message to websocket server.close
(int code) Close a websocket and send a close message to websocket server.Close a websocket and send a close message to websocket server.boolean
isOpen()
True for opened connection.Add an on message callback.Send a websocket message to a websocket server.
-
Method Details
-
isOpen
public boolean isOpen()True for opened connection.- Returns:
- True for opened connection.
-
send
Send a websocket message to a websocket server.- Parameters:
message
- Message.- Returns:
- This client.
-
close
Close a websocket and send a close message to websocket server.- Returns:
- This client.
-
close
Close a websocket and send a close message to websocket server.- Parameters:
code
- Close status code.- Returns:
- This client.
-
close
Close a websocket and send a close message to websocket server.- Parameters:
code
- Close status code.reason
- Close reason.- Returns:
- This client.
-
onMessage
Add an on message callback. Fire it when websocket server send a message.- Parameters:
callback
- Callback to execute.- Returns:
- This client.
-