Replaced InetAddress.getByName function call with a more reliable method that doesnt rely on ping