Class WSProbe
java.lang.Object
org.apache.pekko.http.javadsl.testkit.WSProbe
A WSProbe is a probe that implements a 
Flow[Message, Message, Unit] for testing
 websocket code.
 Requesting elements is handled automatically.
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionstatic WSProbecreate(org.apache.pekko.actor.ActorSystem system, org.apache.pekko.stream.Materializer materializer) static WSProbecreate(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.voidExpect completion on the input side of the flow.Expect a message on the input side of the flow.voidexpectMessage(String text) Expect a text message on the input side of the flow and compares its payload with the given one.voidexpectMessage(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.voidExpect no message on the input side of the flow.voidexpectNoMessage(Duration max) Expect no message on the input side of the flow for the given maximum duration.voidexpectNoMessage(scala.concurrent.duration.FiniteDuration max) Expect no message on the input side of the flow for the given maximum duration.flow()voidComplete the output side of the flow.voidsendMessage(String text) Send a text message containing the given string out of the flow.voidsendMessage(Message message) Send the given messages out of the flow.voidsendMessage(org.apache.pekko.util.ByteString bytes) Send a binary message containing the given bytes out of the flow.
- 
Constructor Details- 
WSProbe
 
- 
- 
Method Details- 
createpublic static WSProbe create(org.apache.pekko.actor.ActorSystem system, org.apache.pekko.stream.Materializer materializer) 
- 
createpublic 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.- Parameters:
- 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)
- Returns:
- (undocumented)
 
- 
flow
- 
sendMessageSend the given messages out of the flow.- Parameters:
- message- (undocumented)
 
- 
sendMessageSend a text message containing the given string out of the flow.- Parameters:
- text- (undocumented)
 
- 
sendMessagepublic void sendMessage(org.apache.pekko.util.ByteString bytes) Send a binary message containing the given bytes out of the flow.- Parameters:
- bytes- (undocumented)
 
- 
sendCompletionpublic void sendCompletion()Complete the output side of the flow.
- 
expectMessageExpect a message on the input side of the flow.- Returns:
- (undocumented)
 
- 
expectMessageExpect a text message on the input side of the flow and compares its payload with the given one. If the received message is streamed its contents are collected and then asserted against the given String.- Parameters:
- text- (undocumented)
 
- 
expectMessagepublic 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. If the received message is streamed its contents are collected and then asserted against the given ByteString.- Parameters:
- bytes- (undocumented)
 
- 
expectNoMessagepublic void expectNoMessage()Expect no message on the input side of the flow.
- 
expectNoMessagepublic void expectNoMessage(scala.concurrent.duration.FiniteDuration max) Expect no message on the input side of the flow for the given maximum duration.- Parameters:
- max- (undocumented)
 
- 
expectNoMessageExpect no message on the input side of the flow for the given maximum duration.- Parameters:
- max- (undocumented)
- Since:
- 1.3.0
 
- 
expectCompletionpublic void expectCompletion()Expect completion on the input side of the flow.
 
-