I have a Finagle server which apperently there´s no way to know when is rerally up.
Having this code
esbMockServer = Some(defaultServer
.serve(s"localhost:$esbPort", esbService))
println(s"Running Finagle Regular Esb Mock Server in port $esbPort.......")
Await.ready(esbMockServer.get,10 second)
Always throw a timeout exception in the Await, but it´s up and running properly since second 1.
Any idea what´s wrong here?
Await.readydoes not do what you seem to think it does. It's basically the same asAwait.result, except that it returns theAwaitableobject itself rather than the result.The bottom line is,
Await.readywill return after theServeris stopped (.closeis called on it), not when it is "ready" ... the latter should be the case, pretty much, right away, you don't need to wait for it.Typically, you'll want to put
Await.ready(server)at the end of yourmainfunction to block the main thread forever, until the server exits.