Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Properties systemSettings = System.getProperties();
- String User = "myusername";
- String Password = "mypassword";
- systemSettings.put("proxySet", "true");
- systemSettings.put("https.proxyHost", "192.1.1.20");
- systemSettings.put("https.proxyPort", "8888");
- systemSettings.put("http.proxyHost", "192.1.1.20");
- systemSettings.put("http.proxyPort", "8888");
- Authenticator.setDefault(new ProxyAuthenticator(User ,Password));
- HttpURLConnection conn = (HttpURLConnection) new URL("http://www.google.com/").openConnection();
- String encodedUserPwd = Base64Converter.encode("myuser:mypassword".getBytes());
- conn.setRequestProperty("Proxy-Authorization", "Basic " + encodedUserPwd);
- conn.connect();
- BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream()));
- String inputLine;
- while ((inputLine = in.readLine()) != null) {
- }
- WebView webView = new WebView();
- WebEngine engine = webView.getEngine();
- engine.load("http://www.google.com/");
- VBox root = new VBox();
- root.getChildren().addAll(webView);
- Scene scene = new Scene(root, 1200, 700);
- primaryStage.setScene(scene);
- primaryStage.show();
- in.close();
Add Comment
Please, Sign In to add comment