Hi Rich,

I see two 200 OK responses when I try to run that.
I use latest code, which should correspond to 1.0-M3.

/Patrik

On Wed, Feb 11, 2015 at 4:12 PM, Richard Bradley <
[email protected]> wrote:

> I feel like I'm missing something obvious here, but I can't get this to
> work.
>
> Please could someone tell me why the following test fails?
> I'm using "akka-stream-and-http-experimental-1.0-M2"
>
> import akka.actor.ActorSystem
> import akka.http.Http
> import akka.http.model.{HttpResponse, StatusCodes, HttpRequest}
> import akka.stream.FlowMaterializer
> import akka.stream.scaladsl.{Sink, Source}
> import org.specs2.mutable.Specification
> import org.specs2.time.NoTimeConversions
> import scala.concurrent.Await
> import scala.concurrent.duration._
>
>
> class ReuseConnectionSpec
>   extends Specification
>   with NoTimeConversions {
>
>
>   "two requests on the same connection" should {
>     "give two responses" in {
>
>
>       val responses = sendRequestsOnSameConnection(
>         "example.com",
>         HttpRequest(uri = "/"),
>         HttpRequest(uri = "/"))
>
>
>       responses.length mustEqual 2
>       responses must beLike {
>         case List(first, second) =>
>           first.status mustEqual StatusCodes.OK
>
>
>           second.status mustEqual StatusCodes.OK
>       }
>     }
>   }
>
>
>   private implicit val system = ActorSystem()
>   private implicit val fm = FlowMaterializer()
>
>
>   private def sendRequestsOnSameConnection(
>     hostname: String,
>     requests: HttpRequest*
>   ): List[HttpResponse] = {
>
>
>     val http = Http()
>     val connection = http.outgoingConnection(hostname)
>
>
>     val responses = Source(requests.toList)
>       .via(connection.flow)
>       .runWith(Sink.fold(List[HttpResponse]())(_ :+ _))
>
>
>     Await.result(responses, 10.seconds)
>   }
> }
>
>
> Thanks very much,
>
>
>
> Rich
>
>  --
> >>>>>>>>>> Read the docs: http://akka.io/docs/
> >>>>>>>>>> Check the FAQ:
> http://doc.akka.io/docs/akka/current/additional/faq.html
> >>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user
> ---
> You received this message because you are subscribed to the Google Groups
> "Akka User List" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/akka-user.
> For more options, visit https://groups.google.com/d/optout.
>



-- 

Patrik Nordwall
Typesafe <http://typesafe.com/> -  Reactive apps on the JVM
Twitter: @patriknw

[image: Scala Days] <http://event.scaladays.org/scaladays-sanfran-2015>

-- 
>>>>>>>>>>      Read the docs: http://akka.io/docs/
>>>>>>>>>>      Check the FAQ: 
>>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>>>>>>>      Search the archives: https://groups.google.com/group/akka-user
--- 
You received this message because you are subscribed to the Google Groups "Akka 
User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to