use of org.apache.camel.http.common.HttpConfiguration in project camel by apache.
the class HttpProxyAuthNTLMTest method createRouteBuilder.
@Override
protected RouteBuilder createRouteBuilder() throws Exception {
return new RouteBuilder() {
public void configure() {
// setup proxy details
HttpConfiguration config = new HttpConfiguration();
config.setProxyHost("myProxyHosy");
config.setProxyPort(1234);
config.setProxyAuthMethod("NTLM");
config.setProxyAuthUsername("myUser");
config.setProxyAuthPassword("myPassword");
config.setProxyAuthDomain("myDomain");
config.setProxyAuthHost("myHost");
HttpComponent http = context.getComponent("http", HttpComponent.class);
http.setHttpConfiguration(config);
from("direct:start").to("http://www.google.com/search");
}
};
}
use of org.apache.camel.http.common.HttpConfiguration in project camel by apache.
the class HttpProxyTest method testHttpProxyComponentConfigured.
@Test
public void testHttpProxyComponentConfigured() throws Exception {
HttpConfiguration config = new HttpConfiguration();
config.setProxyHost("myotherproxy");
config.setProxyPort(2345);
HttpComponent comp = context.getComponent("http", HttpComponent.class);
comp.setHttpConfiguration(config);
HttpEndpoint http = context.getEndpoint("http://www.google.com", HttpEndpoint.class);
context.getProperties().put("http.proxyHost", "myproxy");
context.getProperties().put("http.proxyPort", "1234");
try {
HttpClient client = http.createHttpClient();
assertEquals("myotherproxy", client.getHostConfiguration().getProxyHost());
assertEquals(2345, client.getHostConfiguration().getProxyPort());
} finally {
context.getProperties().remove("http.proxyHost");
context.getProperties().remove("http.proxyPort");
}
}
use of org.apache.camel.http.common.HttpConfiguration in project camel by apache.
the class HttpAuthMethodPriorityTest method createRouteBuilder.
@Override
protected RouteBuilder createRouteBuilder() throws Exception {
return new RouteBuilder() {
public void configure() {
// setup proxy details
HttpConfiguration config = new HttpConfiguration();
config.setAuthMethod("Basic");
config.setAuthUsername("myUser");
config.setAuthPassword("myPassword");
// to avoid NTLM
config.setAuthMethodPriority("Basic,Digest");
HttpComponent http = context.getComponent("http", HttpComponent.class);
http.setHttpConfiguration(config);
from("direct:start").to("http://www.google.com/search");
}
};
}
use of org.apache.camel.http.common.HttpConfiguration in project camel by apache.
the class HttpProxyAuthBasicTest method createRouteBuilder.
@Override
protected RouteBuilder createRouteBuilder() throws Exception {
return new RouteBuilder() {
public void configure() {
// setup proxy details
HttpConfiguration config = new HttpConfiguration();
config.setProxyHost("myProxyHosy");
config.setProxyPort(1234);
// proxy requires auth as well
config.setProxyAuthMethod("Basic");
config.setProxyAuthUsername("myUser");
config.setProxyAuthPassword("myPassword");
HttpComponent http = context.getComponent("http", HttpComponent.class);
http.setHttpConfiguration(config);
from("direct:start").to("http://www.google.com/search");
}
};
}
use of org.apache.camel.http.common.HttpConfiguration in project camel by apache.
the class HttpProxyAuthDigestTest method createRouteBuilder.
@Override
protected RouteBuilder createRouteBuilder() throws Exception {
return new RouteBuilder() {
public void configure() {
// setup proxy details
HttpConfiguration config = new HttpConfiguration();
config.setProxyAuthMethod("Digest");
config.setProxyAuthUsername("myUser");
config.setProxyAuthPassword("myPassword");
HttpComponent http = context.getComponent("http", HttpComponent.class);
http.setHttpConfiguration(config);
from("direct:start").to("http://www.google.com/search");
}
};
}
Aggregations