This is used when General Service-side validation is done in basic mode.
public void testcj{Private String username= "test";
Private String password= "test" static class Myauthenticator extends Authenticator {@Override Public Passwordauthentication getpasswordauthentication () {return (new passwordauthentication username
, Password.tochararray ()));
@Test public void Test () {Authenticator.setdefault () (New Myauthenticator ());
Gets the connection URL url = new URL ("");
HttpURLConnection conn = (httpurlconnection) url.opentconnection ();
Conn.setrequestmethod ("get");
Conn.setdoinput (TRUE);
Conn.setdooutput (TRUE);
Conn.connect ();
Gets the data stream InputStream is = Conn.getinputstream (); BufferedReader reader = new BufferedReader (new InputStreamReader (IS, "Utf-8"), 5*1024*1024);
Set String next = NULL based on server encoding;
while (next = Reader.readline ())!= null) {sb.append (next); } if (Stringutils.isblank (Sb.tostring ())) {//system.out.println ("result set is null");
return null;
}else{return sb.tostring (); }
}
}