package org.spacehq.mc.auth.test;

import org.spacehq.mc.auth.GameProfile;
import org.spacehq.mc.auth.GameProfileRepository;
import org.spacehq.mc.auth.ProfileLookupCallback;
import org.spacehq.mc.auth.UserAuthentication;
import org.spacehq.mc.auth.exception.AuthenticationException;

import java.util.UUID;

public class Test {

	private static final String USERNAME = "Username";
	private static final String EMAIL = "Username@mail.com";
	private static final String PASSWORD = "Password";
	private static final String ACCESS_TOKEN = null;

	public static void main(String[] args) {
		profileLookup();
		auth();
	}

	private static void profileLookup() {
		GameProfileRepository repository = new GameProfileRepository();
		repository.findProfilesByNames(new String[] { USERNAME }, new ProfileLookupCallback() {
			@Override
			public void onProfileLookupSucceeded(GameProfile profile) {
				System.out.println("Found profile: " + profile);
			}

			@Override
			public void onProfileLookupFailed(GameProfile profile, Exception e) {
				System.out.println("Lookup for profile " + profile.getName() + " failed!");
				e.printStackTrace();
			}
		});
	}

	private static void auth() {
		String clientToken = UUID.randomUUID().toString();
		UserAuthentication auth = new UserAuthentication(clientToken);
		auth.setUsername(EMAIL);
		if(ACCESS_TOKEN != null) {
			auth.setAccessToken(ACCESS_TOKEN);
		} else {
			auth.setPassword(PASSWORD);
		}

		try {
			auth.login();
			System.out.println("Access Token: " + auth.getAccessToken());
			System.out.println("Profiles: " + auth.getAvailableProfiles());
		} catch(AuthenticationException e) {
			System.err.println("Failed to login!");
			e.printStackTrace();
		}
	}

}

@@ -278,16 +278,39 @@
 ption;%0A%0A
+import java.net.Proxy;%0A
 import j
@@ -324,16 +324,16 @@
 l.UUID;%0A
-
 %0Apublic 
@@ -559,16 +559,69 @@
  null;%0A%0A
+%09private static final Proxy PROXY = Proxy.NO_PROXY;%0A%0A
 %09public 
@@ -726,16 +726,16 @@
 kup() %7B%0A
-
 %09%09GamePr
@@ -789,16 +789,21 @@
 ository(
+PROXY
 );%0A%09%09rep
@@ -1373,16 +1373,23 @@
 entToken
+, PROXY
 );%0A%09%09aut

Add proxy to example.