client: import stream implementation from dotcloud/docker
client: some improvement in the code structure

* Added ErrConnectionRefused, for errors in connection with the Docker
  daemon endpoint
* Some minor improvements in stream code