title: Futures to send concurrent HTTP GET requests
body: <p>Suppose I am writing a function to send a few concurrent HTTP GET requests and wait for all the responses with a time-out. If at least one response does not have status <code>200</code> or does not come within the time-out my function should return failure.</p>
  
  <p>I am writing this function <code>tryGets</code> like this:</p>
  
  <pre><code>import java.net.URL
  
  import scala.concurrent.duration._
  import scala.concurrent.{Await, ExecutionContext, Future}
  import scala.util.Try
  
  def unsafeGet(url: URL): String = {
    val in = url.openStream()
    scala.io.Source.fromInputStream(in).mkString
  }
  
  def futureGet(url: URL)
               (implicit ec: ExecutionContext): Future[String] = Future {
    unsafeGet(url)
  }
  
  def tryGets(urls: Seq[URL], timeOut: Duration)
              (implicit ec: ExecutionContext): Try[Seq[String]] = Try {
    val fut = Future.sequence(urls.map(futureGet))
    Await.result(fut, timeOut)
  }
  </code></pre>
  
  <p>Does it make sense ? 
  Does not it leak future instances in case of time-out ?</p>