com.github.dushixiang.test.Test0 Maven / Gradle / Ivy
package com.github.dushixiang.test;
import com.github.dushixiang.HttpRequest;
/**
* Created by dushixiang
* datetime on 2017/7/27 12:04.
*/
public class Test0 {
public static void main(String[] args) {
t2();
}
public static void t0(){
HttpRequest.HttpResponse response = new HttpRequest().get("http://www.baidu.com");
System.out.println(response.code());
System.out.println(response.text());
}
public static void t1(){
String result = new HttpRequest()
.proxy("180.168.179.193",8080)
.get("http://www.baidu.com")
.text();
System.out.println(result);
}
public static void t2(){
// String param = "{\"auth\":{\"identity\":{\"password\":{\"user\":{\"name\":\"nsrep-usr\",\"password\":\"nsrep-pwd\",\"domain\":{\"name\":\"default\"}}},\"methods\":[\"password\"]},\"scope\":{\"project\":{\"name\":\"nsrep-prj\",\"domain\":{\"name\":\"default\"}}}}}\n";
// HttpRequest.HttpResponse res =
// new HttpRequest().header("Content-Type","application/json;charset=UTF-8")
// .proxy("127.0.0.1",8888)
// .param(param.getBytes())
// .post("http://192.168.100.11:5000/v3/auth/tokens");
//
// if(res.code() > 300){
// System.err.println("Fuck !!!!!!!1");
// return;
// }
// System.out.println("login success ~~~");
// String token = res.header("X-Subject-Token").get(0);
HttpRequest.HttpResponse res2 = new HttpRequest()
.header("Content-Type","application/json;charset=UTF-8")
.header("X-Auth-Token","123")
.get("http://192.168.100.11:8774/v2/56cf34383e71400db23c20815686c612/servers/e0857eda-730f-4a01-b680-e9e92030bd2f");
System.out.println(res2.code());
System.out.println(res2.text());
}
public static void t3(){
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy