Added UT based on gtest & gmock library. Refactor of socket to fit unit test.