title: Cannot assign requested address with golang and net/http packages
body: <p>I have this server in golang : </p>
  
  <pre><code>package main
  
  import (
      "fmt"
      "net/http"
   )
  
  func hello(w http.ResponseWriter, r *http.Request) {
      w.WriteHeader(204)
      fmt.Fprintf(w, "Hi there, I love %s!", r.URL.Path[1:])
  
      w.Header().Set("Connection", "close")
  
      fmt.Println(r.Close)
  }
  
  func main() {
  
      http.HandleFunc("/", hello)
      http.ListenAndServe(":8080", nil)
  }
  </code></pre>
  
  <p>Then I wanted to try to quickly benchmark how it can handle requests whit this python script:</p>
  
  <pre><code>import requests
  
  payload = "test"
  
  while True:
      r = requests.post("http://127.0.0.1:8080/test", data = payload)
      r.connection.close()
  </code></pre>
  
  <p>After multiple loops it cannot assign new ports. I deduce that my server doesn't close connection (or my client).</p>
  
  <p>How should I manage connection from server side?</p>