Search in sources :

Example 6 with HttpResponse

use of com.bluenimble.platform.http.response.HttpResponse 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());
    }
}
Also used : Proxy(java.net.Proxy) InetSocketAddress(java.net.InetSocketAddress) GetRequest(com.bluenimble.platform.http.request.impls.GetRequest) HttpResponse(com.bluenimble.platform.http.response.HttpResponse) URI(java.net.URI) DefaultHttpClient(com.bluenimble.platform.http.impls.DefaultHttpClient)

Aggregations

HttpResponse (com.bluenimble.platform.http.response.HttpResponse)6 JsonObject (com.bluenimble.platform.json.JsonObject)4 GetRequest (com.bluenimble.platform.http.request.impls.GetRequest)3 ByteArrayOutputStream (java.io.ByteArrayOutputStream)3 URI (java.net.URI)3 DefaultHttpClient (com.bluenimble.platform.http.impls.DefaultHttpClient)2 InputStream (java.io.InputStream)2 OutputStream (java.io.OutputStream)2 ApiOutput (com.bluenimble.platform.api.ApiOutput)1 ApiServiceExecutionException (com.bluenimble.platform.api.ApiServiceExecutionException)1 JsonApiOutput (com.bluenimble.platform.api.impls.JsonApiOutput)1 Config (com.bluenimble.platform.api.impls.im.LoginServiceSpi.Config)1 CommandExecutionException (com.bluenimble.platform.cli.command.CommandExecutionException)1 DefaultCommandResult (com.bluenimble.platform.cli.command.impls.DefaultCommandResult)1 StreamPointer (com.bluenimble.platform.cli.command.parser.converters.StreamPointer)1 YamlObject (com.bluenimble.platform.cli.impls.YamlObject)1 HttpClientException (com.bluenimble.platform.http.HttpClientException)1 HttpEndpoint (com.bluenimble.platform.http.HttpEndpoint)1 HttpHeader (com.bluenimble.platform.http.HttpHeader)1 HttpMessageBody (com.bluenimble.platform.http.HttpMessageBody)1