public class WSProbe
extends java.lang.Object
Flow[Message, Message, Unit]
for testing
websocket code.
Requesting elements is handled automatically.
Modifier and Type | Method and Description |
---|---|
static WSProbe |
create(org.apache.pekko.actor.ActorSystem system,
org.apache.pekko.stream.Materializer materializer) |
static WSProbe |
create(org.apache.pekko.actor.ActorSystem system,
org.apache.pekko.stream.Materializer materializer,
int maxChunks,
long maxChunkCollectionMills)
Creates a WSProbe to use in tests against websocket handlers.
|
void |
expectCompletion()
Expect completion on the input side of the flow.
|
Message |
expectMessage()
Expect a message on the input side of the flow.
|
void |
expectMessage(org.apache.pekko.util.ByteString bytes)
Expect a binary message on the input side of the flow and compares its payload with the given one.
|
void |
expectMessage(java.lang.String text)
Expect a text message on the input side of the flow and compares its payload with the given one.
|
void |
expectNoMessage()
Expect no message on the input side of the flow.
|
void |
expectNoMessage(scala.concurrent.duration.FiniteDuration max)
Expect no message on the input side of the flow for the given maximum duration.
|
org.apache.pekko.stream.javadsl.Flow<Message,Message,org.apache.pekko.NotUsed> |
flow() |
void |
sendCompletion()
Complete the output side of the flow.
|
void |
sendMessage(org.apache.pekko.util.ByteString bytes)
Send a binary message containing the given bytes out of the flow.
|
void |
sendMessage(Message message)
Send the given messages out of the flow.
|
void |
sendMessage(java.lang.String text)
Send a text message containing the given string out of the flow.
|
public WSProbe(WSProbe delegate)
public static WSProbe create(org.apache.pekko.actor.ActorSystem system, org.apache.pekko.stream.Materializer materializer)
public static WSProbe create(org.apache.pekko.actor.ActorSystem system, org.apache.pekko.stream.Materializer materializer, int maxChunks, long maxChunkCollectionMills)
maxChunks
- The maximum number of chunks to collect for streamed messages.maxChunkCollectionMills
- The maximum time in milliseconds to collect chunks for streamed messages.system
- (undocumented)materializer
- (undocumented)public void sendMessage(Message message)
message
- (undocumented)public void sendMessage(java.lang.String text)
text
- (undocumented)public void sendMessage(org.apache.pekko.util.ByteString bytes)
bytes
- (undocumented)public void sendCompletion()
public Message expectMessage()
public void expectMessage(java.lang.String text)
text
- (undocumented)public void expectMessage(org.apache.pekko.util.ByteString bytes)
bytes
- (undocumented)public void expectNoMessage()
public void expectNoMessage(scala.concurrent.duration.FiniteDuration max)
max
- (undocumented)public void expectCompletion()