Thanks for trying.
I get only one response out: "'1' is not equal to '2'"

I am now using "com.typesafe.akka" % "akka-http-experimental_2.11" 
% "1.0-M3"

I'm also using Java 1.6.0_21 x64 on Windows 7 with Scala 2.11.4

Are you on unix? I'll try on a linux box and see if that makes a difference.


On Thursday, February 12, 2015 at 9:54:07 AM UTC, Patrik Nordwall wrote:
>
> 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] <javascript:>> 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] <javascript:>.
>> To post to this group, send email to [email protected] 
>> <javascript:>.
>> 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