Skip to content

Instantly share code, notes, and snippets.

@Thomvis
Created June 6, 2011 19:34
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Thomvis/1010918 to your computer and use it in GitHub Desktop.
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.
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