2017-02-11 28 views
3

嗨下面的代碼按預期工作。akka http client system.shutdown()在使用https時產生「傳出請求流錯誤(akka.stream.AbruptTerminationException)」

implicit val system = ActorSystem() 
implicit val materializer = ActorMaterializer() 

import system.dispatcher 

val request = HttpRequest(uri = "http://www.google.com") 

Http.get(system).singleRequest(request).map(_.entity.dataBytes.runWith(Sink.ignore)) 
    .onComplete { _ => 
    println("shutting down actor system...") 
    system.terminate() 
    } 

但是,如果我改變http://www.google.comhttps://www.google.com類似如下:

implicit val system = ActorSystem() 
implicit val materializer = ActorMaterializer() 

import system.dispatcher 

val request = HttpRequest(uri = "https://www.google.com") 

Http.get(system).singleRequest(request).map(_.entity.dataBytes.runWith(Sink.ignore)) 
    .onComplete { _ => 
    println("shutting down actor system...") 
    system.terminate() 
    } 

我收到以下錯誤信息:

shutting down actor system... 
[ERROR] [02/11/2017 13:13:08.929] [default-akka.actor.default-dispatcher-4] [akka.actor.ActorSystemImpl(default)] Outgoing request stream error (akka.stream.AbruptTerminationException) 

任何人都知道爲什麼HTTPS產生上面的錯誤,以及如何能我修復它?

回答

相關問題