Add missing pieces and tests for file descriptor passing
Includes a few fixes in transport code that aren't strictly related.