Refactored the tcp transport. Closes #7. Added a few more tests

Signed-off-by: Daniel Fagnan <dnfagnan@gmail.com>