Rescue buffered data before consuming from stream

I managed to [track down a hang when calling `build()`](https://groups.google.com/forum/#!topic/docker-dev/fhrTqwF7IJQ) to a problem handling streams.

`strace` proved that the problem was somewhere in the python client and I manage to create a test harness for this issue.

This is not the most elegant fix, I could do with some advice:
* I've changed the return value of attach_socket
* In _stream_helper it creates a new fileobj, when we just threw away the one which had our data buffer in it, we could just keep the old one.
I need to test what happens if the chunk was of length 1; does `chunk_left` become 0? What happens then?