use of org.eclipse.jetty.client.HttpClient in project druid by druid-io.
the class AsyncQueryForwardingServlet method createHttpClient.
@Override
protected HttpClient createHttpClient() throws ServletException {
HttpClient client = super.createHttpClient();
// override timeout set in ProxyServlet.createHttpClient
setTimeout(httpClientConfig.getReadTimeout().getMillis());
return client;
}
use of org.eclipse.jetty.client.HttpClient in project elastic-job by dangdangdotcom.
the class RestfulServerTest method sentRequest.
private static ContentExchange sentRequest(final String content) throws Exception {
HttpClient httpClient = new HttpClient();
try {
httpClient.start();
ContentExchange result = new ContentExchange();
result.setMethod("POST");
result.setRequestContentType(MediaType.APPLICATION_JSON);
result.setRequestContent(new ByteArrayBuffer(content.getBytes("UTF-8")));
httpClient.setConnectorType(HttpClient.CONNECTOR_SELECT_CHANNEL);
result.setURL(URL);
httpClient.send(result);
result.waitForDone();
return result;
} finally {
httpClient.stop();
}
}
use of org.eclipse.jetty.client.HttpClient in project elastic-job by dangdangdotcom.
the class RestfulTestsUtil method sentGetRequest.
public static String sentGetRequest(final String url) throws Exception {
HttpClient httpClient = new HttpClient();
try {
httpClient.start();
ContentExchange contentExchange = new ContentExchange();
contentExchange.setMethod("GET");
contentExchange.setRequestContentType(MediaType.APPLICATION_JSON);
httpClient.setConnectorType(HttpClient.CONNECTOR_SELECT_CHANNEL);
contentExchange.setURL(url);
httpClient.send(contentExchange);
contentExchange.waitForDone();
return contentExchange.getResponseContent();
} finally {
httpClient.stop();
}
}
use of org.eclipse.jetty.client.HttpClient in project elastic-job by dangdangdotcom.
the class RestfulTestsUtil method sentRequest.
public static int sentRequest(final String url, final String method) throws Exception {
HttpClient httpClient = new HttpClient();
try {
httpClient.start();
ContentExchange contentExchange = new ContentExchange();
contentExchange.setMethod(method);
contentExchange.setURL(url);
httpClient.send(contentExchange);
contentExchange.waitForDone();
return contentExchange.getResponseStatus();
} finally {
httpClient.stop();
}
}
use of org.eclipse.jetty.client.HttpClient in project camel by apache.
the class BulkApiIntegrationTest method testRetry.
@Test
public void testRetry() throws Exception {
final SalesforceComponent sf = context().getComponent("salesforce", SalesforceComponent.class);
final String accessToken = sf.getSession().getAccessToken();
final SslContextFactory sslContextFactory = new SslContextFactory();
sslContextFactory.setSslContext(new SSLContextParameters().createSSLContext(context));
final HttpClient httpClient = new HttpClient(sslContextFactory);
httpClient.setConnectTimeout(60000);
httpClient.start();
final String uri = sf.getLoginConfig().getLoginUrl() + "/services/oauth2/revoke?token=" + accessToken;
final Request logoutGet = httpClient.newRequest(uri).method(HttpMethod.GET).timeout(1, TimeUnit.MINUTES);
final ContentResponse response = logoutGet.send();
assertEquals(HttpStatus.OK_200, response.getStatus());
final JobInfo jobInfo = new JobInfo();
jobInfo.setOperation(OperationEnum.INSERT);
jobInfo.setContentType(ContentType.CSV);
jobInfo.setObject(Merchandise__c.class.getSimpleName());
createJob(jobInfo);
}
Aggregations