Extracted socket communication to abstract class