Guest User

Untitled

a guest
Jun 29th, 2018
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. Authenticator.setDefault(new Authenticator() {
  2. protected PasswordAuthentication getPasswordAuthentication() {
  3. return new PasswordAuthentication("admin", "1234".toCharArray());
  4. }
  5. });
  6.  
  7. urlConnection = new URL(params[0]);
  8. user = params[1];
  9. pass = params[2];
  10.  
  11. return new PasswordAuthentication(user, pass.toCharArray())
  12.  
  13. httpUrlConnection.getResponseCode();
  14.  
  15. .....
  16.  
  17. httpUrlConnection.setConnectTimeout(2000);
  18. httpUrlConnection.connect();
  19. statusCode = httpUrlConnection.getResponseCode(); //debug stop here
  20. httpUrlConnection.disconnect();
  21. } catch (IOException e) {
  22. e.printStackTrace();
  23. }
  24. return statusCode;
Add Comment
Please, Sign In to add comment