Refactoring and first test with TCP client/server implementation