#19427 do not require Flow in UpgradeToWebsocket

This commit is contained in:
Roland Kuhn 2016-01-17 17:15:44 +01:00
parent 6f89251810
commit ab117c9e56
9 changed files with 45 additions and 42 deletions

View file

@ -8,9 +8,9 @@ import akka.http.impl.engine.ws.InternalCustomHeader
import akka.http.scaladsl.model.headers.{ UpgradeProtocol, Upgrade, `Sec-WebSocket-Protocol` }
import akka.http.scaladsl.model.{ StatusCodes, HttpResponse, HttpRequest, Uri }
import akka.http.scaladsl.model.ws.{ UpgradeToWebsocket, Message }
import akka.stream.scaladsl.Flow
import scala.collection.immutable
import akka.stream.{ Graph, FlowShape }
import akka.stream.scaladsl.Flow
trait WSTestRequestBuilding { self: RouteTest
def WS(uri: Uri, clientSideHandler: Flow[Message, Message, Any], subprotocols: Seq[String] = Nil)(): HttpRequest =
@ -18,7 +18,7 @@ trait WSTestRequestBuilding { self: RouteTest ⇒
.addHeader(new InternalCustomHeader("UpgradeToWebsocketTestHeader") with UpgradeToWebsocket {
def requestedProtocols: immutable.Seq[String] = subprotocols.toList
def handleMessages(handlerFlow: Flow[Message, Message, Any], subprotocol: Option[String]): HttpResponse = {
def handleMessages(handlerFlow: Graph[FlowShape[Message, Message], Any], subprotocol: Option[String]): HttpResponse = {
clientSideHandler.join(handlerFlow).run()
HttpResponse(StatusCodes.SwitchingProtocols,
headers =