Java 类org.apache.http.impl.conn.DefaultRoutePlanner 实例源码
项目:artifactory
文件:HttpClientConfiguratorTest.java
public void testHost() {
HttpClient client = new HttpClientConfigurator().host("bob").getClient();
DefaultRoutePlanner routePlanner = getRoutePlanner(client);
assertThat(routePlanner).isInstanceOf(HttpClientConfigurator.DefaultHostRoutePlanner.class);
assertEquals(((HttpClientConfigurator.DefaultHostRoutePlanner)
routePlanner).getDefaultHost().getHostName(), "bob", "Unexpected host.");
}
项目:SolRDF
文件:IntegrationTestSupertypeLayer.java
/**
* Initilisation procedure for this test case.
*
* @throws UnableToBuildSolRDFClientException in case the client cannot be built.
* @throws Exception in case of Solr startup failure.
*/
@BeforeClass
public static void initITTest() {
System.setProperty("tests.asserts", "false");
System.setProperty("jetty.port", "8080");
System.setProperty("solr.core.name", "store");
System.setProperty("solr.data.dir", initCoreDataDir.getAbsolutePath());
try {
SOLR = createJetty(
"target/solrdf-integration-tests-1.1-dev/solrdf",
JettyConfig.builder()
.setPort(8080)
.setContext("/solr")
.stopAtShutdown(true)
.build());
final HttpClient httpClient = HttpClientBuilder.create()
.setRoutePlanner(
new DefaultRoutePlanner(
new SchemePortResolver() {
@Override
public int resolve(final HttpHost host) throws UnsupportedSchemeException {
return SOLR.getLocalPort();
}
})).build();
SOLRDF_CLIENT = SolRDF.newBuilder()
.withEndpoint("http://127.0.0.1:8080/solr/store")
.withGraphStoreProtocolEndpointPath("/rdf-graph-store")
.withHttpClient(httpClient)
.withSPARQLEndpointPath("/sparql")
.build();
PLAIN_SOLR_CLIENT = new HttpSolrClient(SOLR_URI);
} catch (final Exception exception) {
throw new RuntimeException(exception);
}
}
项目:artifactory
文件:HttpClientConfiguratorTest.java
private DefaultRoutePlanner getRoutePlanner(HttpClient client) {
return TestUtils.getField(client, "routePlanner", DefaultRoutePlanner.class);
}