Added executor framework to the TCP connection.

Also divided things into responsibilities.