Added socket factory and socket wrapper implementation.