fixed socket error in pulsar tests by making disconnect() perform consistently