Refactor Proton-C transport code (IO layers)

See Apache JIRA: PROTON-749 [https://issues.apache.org/jira/browse/PROTON-749].

This code passed all the proton tests on Linux (Fedora 19], and all the tests I can run on Windows, which significantly only excludes the Java tests there.

For more details see the individual checkin comments,