Fixes #51 - Extract common logics to AbstractSocket