Unfortunately, simply asking the network layer below the Application whether it's connected is notoriously unreliable on any platform. There can be many reasons for this; including infrastructure, like proxies, that will happy generate a page explaining why they can't connect... making it look like 'the network' is connected.