For IntelliJ IDEA,
Android Studio or Eclipse



private object PoolInterfaceActor { final case class PoolRequest(request: HttpRequest, responsePromise: Promise[HttpResponse]) extends NoSerializationVerificationNeeded case object Shutdown extends DeadLetterSuppression val name = SeqActorName("PoolInterfaceActor") def props(gateway: PoolGateway)(implicit fm: Materializer) = Props(new PoolInterfaceActor(gateway)).withDeploy(Deploy.local) /** * LogSource for PoolGateway instances * * Using this LogSource allows us to set the log class to `PoolInterfaceActor` and the log source string * to a descriptive name that describes a particular pool instance. */ private val GatewayLogSource: LogSource[PoolGateway] = new LogSource[PoolGateway] { def genString(gateway: PoolGateway): String = { val scheme = if (gateway.hcps.setup.connectionContext.isSecure) "https" else "http" s"Pool(${gateway.gatewayId.name}->$scheme://${gateway.hcps.host}:${gateway.hcps.port})" } override def genString(gateway: PoolGateway, system: ActorSystem): String = s"${system.name}/${genString(gateway)}" override def getClazz(t: PoolGateway): Class[_] = classOf[PoolGateway] } }
object S3Mock { def apply(port: Int): S3Mock = new S3Mock(port, new InMemoryProvider) def apply(port:Int, dir:String) = new S3Mock(port, new FileProvider(dir)) /** * Create an in-memory s3mock instance * @param port a port to bind to. * @return s3mock instance */ def create(port:Int) = apply(port) // Java API /** * Create a file-based s3mock instance * @param port port to bind to * @param dir directory to mount as a collection of buckets. First-level directories will be treated as buckets, their contents - as keys. * @return */ def create(port:Int, dir:String) = apply(port, dir) // Java API /** * Builder class for java api. */ class Builder { private var defaultPort: Int = 8001 private var defaultProvider: Provider = new InMemoryProvider() /** * Set port to bind to * @param port port number * @return */ def withPort(port: Int): Builder = {
bind = Await.result(http.bindAndHandle(route, "0.0.0.0", port), Duration.Inf) logger.info(s"bound to 0.0.0.0:$port") bind val stopped = for { _ <- bind.unbind() _ <- Http().shutdownAllConnectionPools() _ <- system.terminate() } yield {
new HttpExt(system.settings.config getConfig "akka.http")(system)
implicit val executionContext = theSystem.dispatcher val bindingFuture = Http().bindAndHandle( handler = routes, interface = host,
implicit val executionContext = theSystem.dispatcher val bindingFuture = Http().bindAndHandle( handler = routes, interface = host,
val appStartFuture = Http().bindAndHandle(routes, interface, port)
.bindAndHandleAsync( handler = handleRequest(_, connectionContext.isSecure), interface = config.address, port = port,
@DoNotInherit class HttpExt private[http] (private val config: Config)(implicit val system: ExtendedActorSystem) extends akka.actor.Extension with DefaultSSLContextCreation { validateAndWarnAboutLooseSettings() connectionContext: ConnectionContext, log: LoggingAdapter): ServerLayerBidiFlow = { val httpLayer = serverLayerImpl(settings, None, log, connectionContext.isSecure) val tlsStage = sslTlsStage(connectionContext, Server) connectionContext: ConnectionContext = defaultServerHttpContext, settings: ServerSettings = ServerSettings(system), log: LoggingAdapter = system.log): Source[Http.IncomingConnection, Future[ServerBinding]] = bindImpl(interface, port, connectionContext, settings, log) connectionContext: ConnectionContext = defaultServerHttpContext, settings: ServerSettings = ServerSettings(system), log: LoggingAdapter = system.log): Source[Http.IncomingConnection, Future[ServerBinding]] = { val fullLayer = fuseServerBidiFlow(settings, connectionContext, log) tcpBind(interface, choosePort(port, connectionContext, settings), settings) .map(incoming ⇒ { val serverFlow = fullLayer.addAttributes(prepareAttributes(settings, incoming)) join incoming.flow settings: ServerSettings, log: LoggingAdapter)(implicit fm: Materializer): Source[Http.IncomingConnection, Future[ServerBinding]] = bindImpl(interface, port, connectionContext, settings, log) handler: Flow[HttpRequest, HttpResponse, Any],
adaptServerLayer(delegate.serverLayerImpl()) adaptServerLayer(delegate.serverLayerImpl(settings.asScala)) settings: ServerSettings, remoteAddress: Optional[InetSocketAddress]): BidiFlow[HttpResponse, SslTlsOutbound, SslTlsInbound, HttpRequest, NotUsed] = adaptServerLayer(delegate.serverLayerImpl(settings.asScala, remoteAddress.asScala)) remoteAddress: Optional[InetSocketAddress], log: LoggingAdapter): BidiFlow[HttpResponse, SslTlsOutbound, SslTlsInbound, HttpRequest, NotUsed] = adaptServerLayer(delegate.serverLayerImpl(settings.asScala, remoteAddress.asScala, log)) adaptServerLayer(delegate.serverLayerImpl()) settings: ServerSettings, materializer: Materializer): BidiFlow[HttpResponse, SslTlsOutbound, SslTlsInbound, HttpRequest, NotUsed] = adaptServerLayer(delegate.serverLayerImpl(settings.asScala)) remoteAddress: Optional[InetSocketAddress], materializer: Materializer): BidiFlow[HttpResponse, SslTlsOutbound, SslTlsInbound, HttpRequest, NotUsed] = adaptServerLayer(delegate.serverLayerImpl(settings.asScala, remoteAddress.asScala)) log: LoggingAdapter, materializer: Materializer): BidiFlow[HttpResponse, SslTlsOutbound, SslTlsInbound, HttpRequest, NotUsed] = adaptServerLayer(delegate.serverLayerImpl(settings.asScala, remoteAddress.asScala, log)) new Source(delegate.bindImpl(connect.host, connect.port, connectionContext) .map(new IncomingConnection(_)) .mapMaterializedValue(_.map(new ServerBinding(_))(ec).toJava))