First stab at refactoring 'TCPTransport' in order to make it unit testable

The idea is to be able to provide a mock of 'IO(Tcp)' to 'TCPTransport' in
order to test it in isolation as much as possible.