@@ -1542,14 +1542,7 @@ public void idleRequestTimeoutTest() throws Exception {
1542
1542
1543
1543
long t1 = millisTime ();
1544
1544
try {
1545
- c .prepareGet (getTargetUrl ()).setHeaders (h ).setUrl (getTargetUrl ()).execute (new AsyncHandlerAdapter () {
1546
-
1547
- /* @Override */
1548
- public void onThrowable (Throwable t ) {
1549
- // t.printStackTrace();
1550
- }
1551
-
1552
- }).get ();
1545
+ c .prepareGet (getTargetUrl ()).setHeaders (h ).setUrl (getTargetUrl ()).execute ().get ();
1553
1546
Assert .fail ();
1554
1547
} catch (Throwable ex ) {
1555
1548
final long elapsedTime = millisTime () - t1 ;
@@ -1602,9 +1595,7 @@ public void onThrowable(Throwable t) {
1602
1595
public void getShouldAllowBody () throws IllegalArgumentException , IOException {
1603
1596
AsyncHttpClient c = getAsyncHttpClient (null );
1604
1597
try {
1605
- AsyncHttpClient .BoundRequestBuilder builder = c .prepareGet (getTargetUrl ());
1606
- builder .setBody ("Boo!" );
1607
- builder .execute ();
1598
+ c .prepareGet (getTargetUrl ()).setBody ("Boo!" ).execute ();
1608
1599
} finally {
1609
1600
c .close ();
1610
1601
}
@@ -1614,9 +1605,7 @@ public void getShouldAllowBody() throws IllegalArgumentException, IOException {
1614
1605
public void headShouldNotAllowBody () throws IllegalArgumentException , IOException {
1615
1606
AsyncHttpClient c = getAsyncHttpClient (null );
1616
1607
try {
1617
- AsyncHttpClient .BoundRequestBuilder builder = c .prepareHead (getTargetUrl ());
1618
- builder .setBody ("Boo!" );
1619
- builder .execute ();
1608
+ c .prepareHead (getTargetUrl ()).setBody ("Boo!" ).execute ();
1620
1609
} finally {
1621
1610
c .close ();
1622
1611
}
@@ -1630,8 +1619,7 @@ protected String getBrokenTargetUrl() {
1630
1619
public void invalidUri () throws Exception {
1631
1620
AsyncHttpClient c = getAsyncHttpClient (null );
1632
1621
try {
1633
- AsyncHttpClient .BoundRequestBuilder builder = c .prepareGet (getBrokenTargetUrl ());
1634
- Response r = c .executeRequest (builder .build ()).get ();
1622
+ Response r = c .executeRequest (c .prepareGet (getBrokenTargetUrl ()).build ()).get ();
1635
1623
assertEquals (200 , r .getStatusCode ());
1636
1624
} finally {
1637
1625
c .close ();
@@ -1642,8 +1630,7 @@ public void invalidUri() throws Exception {
1642
1630
public void asyncHttpClientConfigBeanTest () throws Exception {
1643
1631
AsyncHttpClient c = getAsyncHttpClient (new AsyncHttpClientConfigBean ().setUserAgent ("test" ));
1644
1632
try {
1645
- AsyncHttpClient .BoundRequestBuilder builder = c .prepareGet (getTargetUrl ());
1646
- Response r = c .executeRequest (builder .build ()).get ();
1633
+ Response r = c .executeRequest (c .prepareGet (getTargetUrl ()).build ()).get ();
1647
1634
assertEquals (200 , r .getStatusCode ());
1648
1635
} finally {
1649
1636
c .close ();
@@ -1655,10 +1642,8 @@ public void bodyAsByteTest() throws Throwable {
1655
1642
final AsyncHttpClient client = getAsyncHttpClient (null );
1656
1643
try {
1657
1644
Response r = client .prepareGet (getTargetUrl ()).execute ().get ();
1658
-
1659
1645
assertEquals (r .getStatusCode (), 200 );
1660
1646
assertEquals (r .getResponseBodyAsBytes (), new byte [] {});
1661
-
1662
1647
} finally {
1663
1648
client .close ();
1664
1649
}
@@ -1669,7 +1654,6 @@ public void mirrorByteTest() throws Throwable {
1669
1654
final AsyncHttpClient client = getAsyncHttpClient (null );
1670
1655
try {
1671
1656
Response r = client .preparePost (getTargetUrl ()).setBody ("MIRROR" ).execute ().get ();
1672
-
1673
1657
assertEquals (r .getStatusCode (), 200 );
1674
1658
assertEquals (new String (r .getResponseBodyAsBytes (), "UTF-8" ), "MIRROR" );
1675
1659
} finally {
0 commit comments