Fix _handle_write() may not send full frame

In _handle_write(), if socket.send does not send
all of the requested bytes, put the remainder back
onto the outbound buffer.
Initialize bytes_written in _handle_write()
Merge pull request #456 from jonkirsch/hotfix-handle-write

Fix _handle_write() may not send full frame