use of com.ning.http.client.Response in project killbill by killbill.
the class TestPlugin method testPassRequestsToKnownPluginButWrongPath.
@Test(groups = "slow")
public void testPassRequestsToKnownPluginButWrongPath() throws Exception {
final String uri = TEST_PLUGIN_NAME + "/somethingSomething";
Response response;
response = killBillClient.pluginGET(uri);
testAndResetAllMarkers(response, 200, new byte[] {}, false, false, false, false, false, false);
response = killBillClient.pluginHEAD(uri);
testAndResetAllMarkers(response, 204, new byte[] {}, false, false, false, false, false, false);
response = killBillClient.pluginPOST(uri, null);
testAndResetAllMarkers(response, 200, new byte[] {}, false, false, false, false, false, false);
response = killBillClient.pluginPUT(uri, null);
testAndResetAllMarkers(response, 200, new byte[] {}, false, false, false, false, false, false);
response = killBillClient.pluginDELETE(uri);
testAndResetAllMarkers(response, 200, new byte[] {}, false, false, false, false, false, false);
response = killBillClient.pluginOPTIONS(uri);
testAndResetAllMarkers(response, 200, new byte[] {}, false, false, false, false, false, false);
}
use of com.ning.http.client.Response in project killbill by killbill.
the class TestPlugin method testPassRequestsToUnknownPlugin.
@Test(groups = "slow")
public void testPassRequestsToUnknownPlugin() throws Exception {
final String uri = "pluginDoesNotExist/something";
Response response;
// We don't test the output here as it is some Jetty specific HTML blurb
response = killBillClient.pluginGET(uri);
testAndResetAllMarkers(response, 404, null, false, false, false, false, false, false);
response = killBillClient.pluginHEAD(uri);
testAndResetAllMarkers(response, 404, null, false, false, false, false, false, false);
response = killBillClient.pluginPOST(uri, null);
testAndResetAllMarkers(response, 404, null, false, false, false, false, false, false);
response = killBillClient.pluginPUT(uri, null);
testAndResetAllMarkers(response, 404, null, false, false, false, false, false, false);
response = killBillClient.pluginDELETE(uri);
testAndResetAllMarkers(response, 404, null, false, false, false, false, false, false);
response = killBillClient.pluginOPTIONS(uri);
testAndResetAllMarkers(response, 404, null, false, false, false, false, false, false);
}
use of com.ning.http.client.Response in project pinot by linkedin.
the class JsonAsyncHttpPinotClientTransport method executeQueryAsync.
@Override
public Future<BrokerResponse> executeQueryAsync(String brokerAddress, final String query) {
try {
final JSONObject json = new JSONObject();
json.put("pql", query);
final String url = "http://" + brokerAddress + "/query";
final Future<Response> response = _httpClient.preparePost(url).setBody(json.toString()).execute();
return new BrokerResponseFuture(response, query, url);
} catch (Exception e) {
throw new PinotClientException(e);
}
}
use of com.ning.http.client.Response in project openhab1-addons by openhab.
the class PlexConnector method internalSendCommand.
private void internalSendCommand(String machineIdentifier, String url) throws IOException {
logger.debug("Calling url {}", url);
BoundRequestBuilder builder = client.prepareGet(url).setHeaders(getDefaultHeaders()).setHeader("X-Plex-Target-Client-Identifier", machineIdentifier);
builder.execute(new AsyncCompletionHandler<Response>() {
@Override
public Response onCompleted(Response response) throws Exception {
if (response.getStatusCode() != 200) {
logger.error("Error while sending command to Plex: {}\r\n{}", response.getStatusText(), response.getResponseBody());
}
return response;
}
@Override
public void onThrowable(Throwable t) {
logger.error("Error sending command to Plex", t);
}
});
}
use of com.ning.http.client.Response in project pinpoint by naver.
the class NingAsyncHttpClientIT method test.
@Test
public void test() throws Exception {
AsyncHttpClient client = new AsyncHttpClient();
try {
Future<Response> f = client.preparePost("http://www.naver.com/").addParameter("param1", "value1").execute();
Response response = f.get();
} finally {
client.close();
}
PluginTestVerifier verifier = PluginTestVerifierHolder.getInstance();
verifier.printCache();
verifier.verifyTrace(event("ASYNC_HTTP_CLIENT", AsyncHttpClient.class.getMethod("executeRequest", Request.class, AsyncHandler.class), null, null, "www.naver.com", annotation("http.url", "http://www.naver.com"), annotation("http.param", "param1=value1")));
verifier.verifyTraceCount(0);
}
Aggregations