@@ -24,7 +24,7 @@ Then in your code you can simply do ([Javadoc](http://sonatype.github.com/async-
24
24
import com.ning.http.client.* ;
25
25
import java.util.concurrent.Future ;
26
26
27
- AsyncHttpClient asyncHttpClient = AsyncHttpClientFactory . getAsyncHttpClient ();
27
+ AsyncHttpClient asyncHttpClient = new AsyncHttpClient ();
28
28
Future<Response > f = asyncHttpClient. prepareGet(" http://www.ning.com/" ). execute();
29
29
Response r = f. get();
30
30
```
@@ -37,7 +37,7 @@ You can also accomplish asynchronous (non-blocking) operation without using a Fu
37
37
import com.ning.http.client.* ;
38
38
import java.util.concurrent.Future ;
39
39
40
- AsyncHttpClient asyncHttpClient = AsyncHttpClientFactory . getAsyncHttpClient ();
40
+ AsyncHttpClient asyncHttpClient = new AsyncHttpClient ();
41
41
asyncHttpClient. prepareGet(" http://www.ning.com/" ). execute(new AsyncCompletionHandler<Response > (){
42
42
43
43
@Override
@@ -62,7 +62,7 @@ You can also mix Future with AsyncHandler to only retrieve part of the asynchron
62
62
import com.ning.http.client.* ;
63
63
import java.util.concurrent.Future ;
64
64
65
- AsyncHttpClient asyncHttpClient = AsyncHttpClientFactory . getAsyncHttpClient ();
65
+ AsyncHttpClient asyncHttpClient = new AsyncHttpClient ();
66
66
Future<Integer > f = asyncHttpClient. prepareGet(" http://www.ning.com/" ). execute(
67
67
new AsyncCompletionHandler<Integer > (){
68
68
@@ -89,7 +89,7 @@ which is something you want to do for large responses: this way you can process
89
89
import com.ning.http.client.* ;
90
90
import java.util.concurrent.Future ;
91
91
92
- AsyncHttpClient c = AsyncHttpClientFactory . getAsyncHttpClient ();
92
+ AsyncHttpClient c = new AsyncHttpClient ();
93
93
Future<String > f = c. prepareGet(" http://www.ning.com/" ). execute(new AsyncHandler<String > () {
94
94
private ByteArrayOutputStream bytes = new ByteArrayOutputStream ();
95
95
@@ -140,7 +140,7 @@ Finally, you can also configure the AsyncHttpClient via its AsyncHttpClientConfi
140
140
``` java
141
141
AsyncHttpClientConfig cf = new AsyncHttpClientConfig .Builder ()
142
142
S . setProxyServer(new ProxyServer (" 127.0.0.1" , 38080 )). build();
143
- AsyncHttpClient c = AsyncHttpClientFactory . getAsyncHttpClient (cf);
143
+ AsyncHttpClient c = new AsyncHttpClient (cf);
144
144
```
145
145
146
146
## WebSocket
@@ -176,7 +176,7 @@ The library uses Java non blocking I/O for supporting asynchronous operations. T
176
176
177
177
``` java
178
178
AsyncHttpClientConfig config = new AsyncHttpClientConfig .Builder (). build();
179
- AsyncHttpClient client = AsyncHttpClientFactory . getAsyncHttpClient (new GrizzlyAsyncHttpProvider (config), config);
179
+ AsyncHttpClient client = new AsyncHttpClient (new GrizzlyAsyncHttpProvider (config), config);
180
180
```
181
181
182
182
## User Group
0 commit comments