mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-04-19 03:01:48 +08:00
fixtest
This commit is contained in:
parent
b8e4a131d8
commit
a8fc406409
@ -9,8 +9,6 @@ import cn.hutool.json.JSONUtil;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.net.Authenticator;
|
||||
import java.net.PasswordAuthentication;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
@ -142,26 +140,4 @@ public class HttpRequestTest {
|
||||
HttpResponse execute = get.execute();
|
||||
Console.log(execute.body());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getByProxy(){
|
||||
System.setProperty("jdk.http.auth.tunneling.disabledSchemes", "");
|
||||
|
||||
// 用户名密码, 若已添加白名单则不需要添加
|
||||
final String ProxyUser = "t10757311156848";
|
||||
final String ProxyPass = "ikm5uu44";
|
||||
|
||||
Authenticator.setDefault(new Authenticator() {
|
||||
public PasswordAuthentication getPasswordAuthentication() {
|
||||
return new PasswordAuthentication(ProxyUser, ProxyPass.toCharArray());
|
||||
}
|
||||
});
|
||||
|
||||
final HttpResponse res = HttpRequest.get("https://httpbin.org/get")
|
||||
.basicAuth(ProxyUser, ProxyPass)
|
||||
.setHttpProxy("tps193.kdlapi.com", 15818).execute();
|
||||
|
||||
Console.log(res.body());
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user