Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -669,13 +669,31 @@ class WebSocketClientSpec extends PekkoSpecWithMaterializer("pekko.http.client.w
closeNetworkInput()
expectNetworkClose()
}
"receive first frame in same chunk as HTTP upgrade response" in new TestSetup with ClientProbes {
expectWireData(UpgradeRequestBytes)

val firstFrame = WSTestUtils.frame(Protocol.Opcode.Text, ByteString("fast"), fin = true, mask = false)
sendWireData(UpgradeResponseBytes ++ firstFrame)

messagesIn.requestNext(TextMessage("fast"))
val firstBinaryPayload = ByteString(1, 0, 2, 3)
Seq[(String, Protocol.Opcode, ByteString, Message)](
("text", Protocol.Opcode.Text, ByteString("fast"), TextMessage("fast")),
("binary", Protocol.Opcode.Binary, firstBinaryPayload, BinaryMessage(firstBinaryPayload))).foreach {
case (kind, opcode, payload, expected) =>
s"receive first frame in same chunk as HTTP upgrade response ($kind)" in {
Utils.assertAllStagesStopped {
new TestSetup with ClientProbes {
try {
expectWireData(UpgradeRequestBytes)

val firstFrame = WSTestUtils.frame(opcode, payload, fin = true, mask = false)
sendWireData(UpgradeResponseBytes ++ firstFrame)

messagesIn.requestNext(expected)
response.awaitResult(1.second.dilated) shouldBe a[ValidUpgrade]
} finally {
messagesOut.sendComplete()
messagesIn.cancel()
netOut.cancel()
closeNetworkInput()
}
}
}
}
}

"manual scenario client sends first" in new EstablishedConnectionSetup with ClientProbes {
Expand Down