use of com.bluenimble.platform.http.impls.DefaultHttpClient in project serverless by bluenimble.
the class SimpleGetRequest method main.
public static void main(String[] args) throws Exception {
DefaultHttpClient client = new DefaultHttpClient();
GetRequest request = new GetRequest(HttpUtils.createEndpoint(new URI("https://api.indix.com/v2/summary/products?countryCode=US&app_id=2a4049dd&app_key=444978937e94a8adebdcd701660da344")));
request.getParameters().add(new HttpParameterImpl("q", "hello kitty"));
HttpResponse response = client.send(request);
response.getBody().dump(System.out, "utf-8", null);
}
use of com.bluenimble.platform.http.impls.DefaultHttpClient in project serverless by bluenimble.
the class UseProxyRequest method main.
public static void main(String[] args) throws Exception {
DefaultHttpClient client = new DefaultHttpClient();
GetRequest request = new GetRequest(HttpUtils.createEndpoint(new URI("http://amazon.com/Apple-Retina-display-MD510LL-9-7-Inch/dp/B009W8YQ6K/ref=sr_1_1?s=pc&ie=UTF8&qid=1414360465&sr=1-1&keywords=ipad")));
request.setProxy(new Proxy(Proxy.Type.HTTP, new InetSocketAddress("us-il.proxymesh.com", 31280)));
HttpResponse response = null;
for (int i = 0; i < 50; i++) {
response = client.send(request);
System.out.println(response.getStatus());
}
}
Aggregations