Improve multi-thread behavior and error pathes of send and recv

Previously there were error paths which would result in a lost context
and there were interleavings when two threads were working on the same
Connection where their outputs would interleave incorrectly
Merge pull request #1 from glguy/master

Improvements to send/recv