Abstract TCP connection code from hub/connection.c into netutil.c

This allows for easier extensibility and re-use than with the previous
solution integrated into hub/connection.c. Although this did simplify
the hub/connection.c code a bit, it's still more complex than I'd like
it to be. The netstream.c abstraction should be more flexible to
simplify things some more.