use of org.apache.http.params.SyncBasicHttpParams in project camel by apache.
the class HttpTestServer method newDefaultParams.
/**
* Obtains a set of reasonable default parameters for a server.
*
* @return default parameters
*/
protected HttpParams newDefaultParams() {
HttpParams params = new SyncBasicHttpParams();
params.setIntParameter(CoreConnectionPNames.SO_TIMEOUT, 60000).setIntParameter(CoreConnectionPNames.SOCKET_BUFFER_SIZE, 8 * 1024).setBooleanParameter(CoreConnectionPNames.STALE_CONNECTION_CHECK, false).setBooleanParameter(CoreConnectionPNames.TCP_NODELAY, true).setParameter(CoreProtocolPNames.ORIGIN_SERVER, "LocalTestServer/1.1");
return params;
}
use of org.apache.http.params.SyncBasicHttpParams in project undertow by undertow-io.
the class TestHttpClient method preventSocketTimeoutException.
private static HttpParams preventSocketTimeoutException(HttpParams params) {
// in CI when running tests on proxy mode
if (DefaultServer.isProxy()) {
if (params == null) {
params = new SyncBasicHttpParams();
setDefaultHttpParams(params);
}
HttpConnectionParams.setSoTimeout(params, 300000);
return params;
}
return params;
}
use of org.apache.http.params.SyncBasicHttpParams in project undertow by undertow-io.
the class FileHandlerSymlinksTestCase method testExplicitAccessSymlinkGrantedUsingSpecificFiltersWithDirectoryListingEnabled.
@Test
public void testExplicitAccessSymlinkGrantedUsingSpecificFiltersWithDirectoryListingEnabled() throws IOException, URISyntaxException {
HttpParams params = new SyncBasicHttpParams();
DefaultHttpClient.setDefaultHttpParams(params);
HttpConnectionParams.setSoTimeout(params, 300000);
TestHttpClient client = new TestHttpClient(params);
Path rootPath = Paths.get(getClass().getResource("page.html").toURI()).getParent();
Path newSymlink = rootPath.resolve("newSymlink");
try {
DefaultServer.setRootHandler(new PathHandler().addPrefixPath("/path", new ResourceHandler(new PathResourceManager(newSymlink, 10485760, true, rootPath.toAbsolutePath().toString().concat("/newDir"))).setDirectoryListingEnabled(false).addWelcomeFiles("page.html")));
/**
* This request should return a 200 code as rootPath + "/newDir" is used in the safePaths
*/
HttpGet get = new HttpGet(DefaultServer.getDefaultServerURL() + "/path/innerSymlink/.");
HttpResponse result = client.execute(get);
Assert.assertEquals(StatusCodes.OK, result.getStatusLine().getStatusCode());
final String response = HttpClientUtils.readResponse(result);
Header[] headers = result.getHeaders("Content-Type");
Assert.assertEquals("text/html", headers[0].getValue());
Assert.assertTrue(response, response.contains("A web page"));
} finally {
client.getConnectionManager().shutdown();
}
}
Aggregations