Wrote tests for pipe overflows - fixes #7

Also found and fixed numerous bugs in the flow control logic,
and eventually decided that flow control on each command
is overkill, so next commit will be to remove it.