implement factory for socket object