use of com.tvd12.ezyhttp.client.test.request.HelloRequest in project ezyfox-examples by tvd12.
the class ApiGetUserTest method main.
public static void main(String[] args) throws Exception {
HttpClientProxy httpClient = HttpClientProxy.builder().build();
httpClient.start();
RequestEntity entity = RequestEntity.builder().build();
Request helloRequest = new GetRequest().setURL(API_URL + "tvd12").setEntity(entity).setResponseType(String.class).setResponseType(StatusCodes.NOT_FOUND, String.class);
String response = httpClient.call(helloRequest, 10000);
System.out.println("get user response: " + response);
}
use of com.tvd12.ezyhttp.client.test.request.HelloRequest in project ezyhttp by youngmonkeys.
the class HttpClientProxyTest method postTest.
protected static void postTest(HttpClientProxy client) throws Exception {
HelloRequest body = new HelloRequest();
body.setWho("dzung");
RequestEntity entity = RequestEntity.body(body);
PostRequest request = new PostRequest().setURL("http://localhost:8081/").setEntity(entity).setResponseType(String.class).setReadTimeout(HttpClient.NO_TIMEOUT).setConnectTimeout(HttpClient.NO_TIMEOUT);
String response = client.call(request, 1000);
System.out.println(response);
}
use of com.tvd12.ezyhttp.client.test.request.HelloRequest in project ezyhttp by youngmonkeys.
the class HttpClientTest method postTest.
protected static void postTest() throws Exception {
HttpClient client = HttpClient.builder().build();
HelloRequest body = new HelloRequest();
body.setWho("dzung");
RequestEntity entity = RequestEntity.body(body);
PostRequest request = new PostRequest().setURL("http://localhost:8081/").setEntity(entity).setResponseType(String.class).setReadTimeout(HttpClient.NO_TIMEOUT).setConnectTimeout(HttpClient.NO_TIMEOUT);
String response = client.call(request);
System.out.println(response);
}
Aggregations