Created
June 6, 2011 19:34
-
-
Save Thomvis/1010918 to your computer and use it in GitHub Desktop.
Check whether the iPhone Developer Center is still down after the WWDC '11 announcements.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.*; | |
import java.net.MalformedURLException; | |
import java.net.URL; | |
import java.net.URLConnection; | |
import java.sql.Timestamp; | |
import java.util.Date; | |
public class IsTheIPhoneDeveloperCenterDown { | |
public static void main(String[] args) throws java.lang.InterruptedException { | |
try { | |
while(true) { | |
System.out.print(new Timestamp(new Date().getTime()) + ": "); | |
try { | |
URL devCenter = new URL("http://developer.apple.com/devcenter/ios/index.action"); | |
URLConnection conn = devCenter.openConnection(); | |
if (conn.getContentLength() == 2510) { | |
System.out.println("Unfortunately, yes..."); | |
} else { | |
System.out.println("\007"); | |
System.out.println("NO IT IS NOT!"); | |
} | |
} catch( java.io.FileNotFoundException e ) { | |
} | |
Thread.sleep(5000); | |
} | |
} catch (MalformedURLException e) { | |
e.printStackTrace(); | |
} catch (IOException e) { | |
e.printStackTrace(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment