More tests (and fixes for the new tests)

Hi Austin,

Attached are some bug fixes (99558ca) and some additional tests to make sure no data is lost when there is not enough room at the destination, etc.  I fixed a couple issues in the code, mostly related to detection if the destination is ready to receive, to make the new tests pass as well.

Have a look and tell me what you think.

Evan