// setup mock server
val json =
"""
|{"result":true}
""".stripMargin
val source = Source(ByteString(json) :: Nil)
val mockRoutes = path("test" / "proxy_chunked.do") {
get {
complete {
HttpResponse(StatusCodes.OK, entity = HttpEntity(ContentTypes.`application/json`, source))
}
}
} ~ complete {
HttpResponse(StatusCodes.NotFound)
}
val (_, host, port) = AkkaHttpTestUtils.temporaryServerHostnameAndPort()
val bindingFuture = Http().bindAndHandle(mockRoutes, host, port)
val request = HttpRequest(
HttpMethods.GET,
uri = s"http://${host}:${port}/test/proxy_chunked.do",
protocol = HttpProtocols.`HTTP/1.0`
)
val futureByteString = Http().singleRequest(request).map { resp =>
println("response returned")
resp.entity.dataBytes
} flatMap { source =>
source.runFold(ByteString.empty)((r, bs) => r ++ bs)
}
val byteString = Await.result(futureByteString, 10 seconds)
byteString.utf8String shouldEqual (json)
Could you include the error?
--
Cheers,
√
--
>>>>>>>>>> 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 akka-user+...@googlegroups.com.
To post to this group, send email to akka...@googlegroups.com.
Visit this group at https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.
INFO - akka.event.slf4j.Slf4jLogger - Slf4jLogger startedDEBUG - akka.event.EventStream - logger log1-Slf4jLogger startedDEBUG - akka.event.EventStream - Default Loggers startedDEBUG - com.typesafe.sslconfig.akka.AkkaSSLConfig - Initializing AkkaSSLConfig extension...DEBUG - com.typesafe.sslconfig.akka.AkkaSSLConfig - buildHostnameVerifier: created hostname verifier: com.typesafe.sslconfig.ssl.DefaultHostnameVerifier@39a2fc30DEBUG - akka.io.TcpListener - Successfully bound to /127.0.0.1:57407DEBUG - akka.http.impl.engine.client.PoolInterfaceActor - (Re-)starting host connection pool to localhost:57407DEBUG - akka.http.impl.engine.client.PoolSlot$SlotProcessor - become unconnected, from subscriber pendingDEBUG - akka.http.impl.engine.client.PoolSlot$SlotProcessor - become unconnected, from subscriber pendingDEBUG - akka.http.impl.engine.client.PoolSlot$SlotProcessor - become unconnected, from subscriber pendingDEBUG - akka.http.impl.engine.client.PoolSlot$SlotProcessor - become unconnected, from subscriber pendingDEBUG - akka.io.TcpOutgoingConnection - Attempting connection to [localhost/127.0.0.1:57407]DEBUG - akka.io.TcpListener - New connection acceptedDEBUG - akka.io.TcpOutgoingConnection - Connection established to [localhost/127.0.0.1:57407]INFO - akka.actor.LocalActorRef - Message [akka.io.Tcp$ResumeReading$] from Actor[akka://ProxyActorTest/user/StreamSupervisor-1/$$b#-1567866888] to Actor[akka://ProxyActorTest/system/IO-TCP/selectors/$a/1#1829940929] was not delivered. [1] dead letters encountered. This logging can be turned off or adjusted with configuration settings 'akka.log-dead-letters' and 'akka.log-dead-letters-during-shutdown'.DEBUG - akka.http.impl.engine.client.PoolSlot$SlotProcessor - Slot 0 disconnected after regular connection closeresponse returned
Futures timed out after [10 seconds]java.util.concurrent.TimeoutException: Futures timed out after [10 seconds] at scala.concurrent.impl.Promise$DefaultPromise.ready(Promise.scala:219) at scala.concurrent.impl.Promise$DefaultPromise.result(Promise.scala:223) at scala.concurrent.Await$$anonfun$result$1.apply(package.scala:190) at scala.concurrent.BlockContext$DefaultBlockContext$.blockOn(BlockContext.scala:53) at scala.concurrent.Await$.result(package.scala:190) at com.oneapm.mordor.actors.marathon.ProxyActorTest$$anonfun$1$$anonfun$apply$mcV$sp$3.apply$mcV$sp(ProxyActorTest.scala:160) at com.oneapm.mordor.actors.marathon.ProxyActorTest$$anonfun$1$$anonfun$apply$mcV$sp$3.apply(ProxyActorTest.scala:122) at com.oneapm.mordor.actors.marathon.ProxyActorTest$$anonfun$1$$anonfun$apply$mcV$sp$3.apply(ProxyActorTest.scala:122)