Skip to content

Commit

Permalink
=htc #364 add test that backpressure will be fixed on akka 2.4.14
Browse files Browse the repository at this point in the history
Fixes #364.
  • Loading branch information
jrudolph committed Nov 22, 2016
1 parent d0d189e commit b392392
Showing 1 changed file with 15 additions and 2 deletions.
Expand Up @@ -8,16 +8,17 @@ import akka.NotUsed

import scala.concurrent.duration._
import scala.util.Random
import org.scalatest.{ Matchers, FreeSpec }
import org.scalatest.{ FreeSpec, Matchers }
import akka.stream.scaladsl._
import akka.stream.testkit._
import akka.util.ByteString
import akka.http.scaladsl.model.ws._
import Protocol.Opcode
import akka.testkit.EventFilter
import akka.stream.OverflowStrategy
import org.scalatest.concurrent.{ Eventually, PatienceConfiguration }

class MessageSpec extends FreeSpec with Matchers with WithMaterializerSpec {
class MessageSpec extends FreeSpec with Matchers with WithMaterializerSpec with Eventually {
import WSTestUtils._

val InvalidUtf8TwoByteSequence: ByteString = ByteString(
Expand Down Expand Up @@ -235,6 +236,18 @@ class MessageSpec extends FreeSpec with Matchers with WithMaterializerSpec {
expectTextMessage(TextMessage.Strict(""))
}
}
"apply backpressure to the network if a message isn't read by the user" in new ServerTestSetup {
val mask = Random.nextInt()
val header = frameHeader(Opcode.Text, 65535, fin = false, mask = Some(mask))

pushInput(header)

// push single-byte ByteStrings without reading anything until it fails
// this should be after the internal input buffers have filled up
eventually(PatienceConfiguration.Interval(1.milli)) {
the[AssertionError] thrownBy pushInput(ByteString("a"))
}
}
}
"render frames from messages" - {
"for binary messages" - {
Expand Down

0 comments on commit b392392

Please sign in to comment.