Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.io.BufferedReader;
- import java.io.IOException;
- import java.io.InputStream;
- import java.io.InputStreamReader;
- import java.net.URL;
- /**
- * Created by Tyler on 11/21/2014.
- */
- public class ProxyTest {
- public void connect() throws IOException {
- System.setProperty("https.proxyHost", "184.107.204.83");
- System.setProperty("https.proxyPort", "3128");
- URL url = new URL("http://whatsmyip.org/");
- InputStream in = url.openStream();
- BufferedReader br = new BufferedReader(new InputStreamReader(in));
- String line = null;
- while ((line = br.readLine()) != null ) {
- System.out.println(line);
- }
- // System.setProperty("https.proxyHost", null);
- }
- public static void main(String[] args) {
- try {
- new ProxyTest().connect();
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement