Skip to content

Instantly share code, notes, and snippets.

@badlogic
Created July 8, 2014 21:26
Show Gist options
  • Save badlogic/a900182375e4a39b612b to your computer and use it in GitHub Desktop.
Save badlogic/a900182375e4a39b612b to your computer and use it in GitHub Desktop.
public class SslTest extends UIApplicationDelegateAdapter {
private UIWindow window = null;
@Override
public boolean didFinishLaunching (UIApplication application, NSDictionary launchOptions) {
try {
// HttpURLConnection connection = (HttpURLConnection)new URL("https://www.google.at/images/srpr/logo11w.png").openConnection();
HttpURLConnection connection = (HttpURLConnection)new URL("http://i.imgur.com/XZt9E04.jpg").openConnection();
System.out.println("connection: " + connection);
InputStream in = connection.getInputStream();
System.out.println("input stream: " + in);
int c = 0;
while(in.available() > 0) {
in.read();
if(c % 1000 == 0) System.out.println("read byte");
c++;
}
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
window = new UIWindow(UIScreen.getMainScreen().getBounds());
window.setBackgroundColor(UIColor.colorLightGray());
window.makeKeyAndVisible();
return true;
}
public static void main (String[] args) {
NSAutoreleasePool pool = new NSAutoreleasePool();
UIApplication.main(args, null, SslTest.class);
pool.close();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment