Java 类org.apache.http.impl.bootstrap.ServerBootstrap 实例源码

项目:dhus-core    文件:TestInterruptibleHttpClient.java   
/**
 * Starts the HTTP server.
 *
 * @return the listening port.
 */
static int start () throws IOException
{

   server = ServerBootstrap.bootstrap ().registerHandler ("*",
         new HttpRequestHandler ()
         {

            @Override
            public void handle (HttpRequest request, HttpResponse response,
                  HttpContext context)
                  throws HttpException, IOException
            {

               response.setStatusCode (HttpStatus.SC_OK);
               response.setEntity (new StringEntity ("0123456789"));
            }
         })
         .create ();
   server.start ();

   return server.getLocalPort ();
}
项目:Camel    文件:HttpProducerContentTypeTest.java   
@Before
@Override
public void setUp() throws Exception {
    localServer = ServerBootstrap.bootstrap().
            setHttpProcessor(getBasicHttpProcessor()).
            setConnectionReuseStrategy(getConnectionReuseStrategy()).
            setResponseFactory(getHttpResponseFactory()).
            setExpectationVerifier(getHttpExpectationVerifier()).
            setSslContext(getSSLContext()).
            registerHandler("/content", new HttpRequestHandler() {
                @Override
                public void handle(HttpRequest request, HttpResponse response, HttpContext context) throws HttpException, IOException {
                    String contentType = request.getFirstHeader(Exchange.CONTENT_TYPE).getValue();

                    assertEquals(CONTENT_TYPE, contentType);

                    response.setEntity(new StringEntity(contentType, "ASCII"));
                    response.setStatusCode(HttpStatus.SC_OK);
                }
            }).create();
    localServer.start();

    super.setUp();
}
项目:Camel    文件:HttpCompressionTest.java   
@Before
@Override
public void setUp() throws Exception {
    Map<String, String> expectedHeaders = new HashMap<String, String>();
    expectedHeaders.put("Content-Type", "text/plain");
    expectedHeaders.put("Content-Encoding", "gzip");

    localServer = ServerBootstrap.bootstrap().
            setHttpProcessor(getBasicHttpProcessor()).
            setConnectionReuseStrategy(getConnectionReuseStrategy()).
            setResponseFactory(getHttpResponseFactory()).
            setExpectationVerifier(getHttpExpectationVerifier()).
            setSslContext(getSSLContext()).
            registerHandler("/", new HeaderValidationHandler("POST", null, getBody(), getExpectedContent(), expectedHeaders)).create();
    localServer.start();

    super.setUp();
}
项目:Camel    文件:HttpPathTest.java   
@Before
@Override
public void setUp() throws Exception {
    localServer = ServerBootstrap.bootstrap().
            setHttpProcessor(getBasicHttpProcessor()).
            setConnectionReuseStrategy(getConnectionReuseStrategy()).
            setResponseFactory(getHttpResponseFactory()).
            setExpectationVerifier(getHttpExpectationVerifier()).
            setSslContext(getSSLContext()).
            registerHandler("/search", new BasicValidationHandler("GET", null, null, getExpectedContent())).
            registerHandler("/test%20/path", new BasicValidationHandler("GET", null, null, getExpectedContent())).
            registerHandler("/testWithQueryParams", new BasicValidationHandler("GET", "abc=123", null, getExpectedContent())).
            create();
    localServer.start();

    super.setUp();
}
项目:Camel    文件:HttpRedirectTest.java   
@Before
@Override
public void setUp() throws Exception {
    localServer = ServerBootstrap.bootstrap().
            setHttpProcessor(getBasicHttpProcessor()).
            setConnectionReuseStrategy(getConnectionReuseStrategy()).
            setResponseFactory(getHttpResponseFactory()).
            setExpectationVerifier(getHttpExpectationVerifier()).
            setSslContext(getSSLContext()).
            registerHandler("/test", new RedirectHandler(HttpStatus.SC_MOVED_PERMANENTLY)).
            registerHandler("/someplaceelse", new BasicValidationHandler("GET", null, null, "Bye World")).
            registerHandler("/test", new RedirectHandler(HttpStatus.SC_MOVED_PERMANENTLY)).
            create();
    localServer.start();

    super.setUp();
}
项目:Camel    文件:HttpProxyServerTest.java   
@Before
@Override
public void setUp() throws Exception {
    Map<String, String> expectedHeaders = new HashMap<>();
    expectedHeaders.put("Proxy-Connection", "Keep-Alive");
    proxy = ServerBootstrap.bootstrap().
            setHttpProcessor(getBasicHttpProcessor()).
            setConnectionReuseStrategy(getConnectionReuseStrategy()).
            setResponseFactory(getHttpResponseFactory()).
            setExpectationVerifier(getHttpExpectationVerifier()).
            setSslContext(getSSLContext()).
            registerHandler("*", new HeaderValidationHandler("GET", null, null, getExpectedContent(), expectedHeaders)).create();
    proxy.start();

    super.setUp();
}
项目:Camel    文件:HttpConcurrentTest.java   
@Before
@Override
public void setUp() throws Exception {
    localServer = ServerBootstrap.bootstrap().
            setHttpProcessor(getBasicHttpProcessor()).
            setConnectionReuseStrategy(getConnectionReuseStrategy()).
            setResponseFactory(getHttpResponseFactory()).
            setExpectationVerifier(getHttpExpectationVerifier()).
            setSslContext(getSSLContext()).
            registerHandler("/", new HttpRequestHandler() {
                public void handle(HttpRequest request, HttpResponse response, HttpContext context) throws HttpException, IOException {
                    try {
                        Thread.sleep(1000);
                    } catch (InterruptedException e) {
                        // ignore
                    }
                    response.setStatusCode(HttpStatus.SC_OK);
                    response.setEntity(new StringEntity("" + counter.incrementAndGet()));
                }
            }).create();
    localServer.start();

    super.setUp();
}
项目:Camel    文件:HttpProducerTwoParametersWithSameKeyTest.java   
@Before
@Override
public void setUp() throws Exception {
    localServer = ServerBootstrap.bootstrap().
            setHttpProcessor(getBasicHttpProcessor()).
            setConnectionReuseStrategy(getConnectionReuseStrategy()).
            setResponseFactory(getHttpResponseFactory()).
            setExpectationVerifier(getHttpExpectationVerifier()).
            setSslContext(getSSLContext()).
            registerHandler("/myapp", new HttpRequestHandler() {
                @Override
                public void handle(HttpRequest request, HttpResponse response, HttpContext context) throws HttpException, IOException {
                    String uri = request.getRequestLine().getUri();
                    assertEquals("/myapp?from=me&to=foo&to=bar", uri);

                    response.setHeader("bar", "yes");
                    response.addHeader("foo", "123");
                    response.addHeader("foo", "456");
                    response.setEntity(new StringEntity("OK", "ASCII"));
                    response.setStatusCode(HttpStatus.SC_OK);
                }
            }).create();
    localServer.start();

    super.setUp();
}
项目:Camel    文件:HttpProducerSelectMethodTest.java   
@Before
@Override
public void setUp() throws Exception {
    localServer = ServerBootstrap.bootstrap().
            setHttpProcessor(getBasicHttpProcessor()).
            setConnectionReuseStrategy(getConnectionReuseStrategy()).
            setResponseFactory(getHttpResponseFactory()).
            setExpectationVerifier(getHttpExpectationVerifier()).
            setSslContext(getSSLContext()).
            registerHandler("/myget", new BasicValidationHandler("GET", null, null, getExpectedContent())).
            registerHandler("/mypost", new BasicValidationHandler("POST", null, null, getExpectedContent())).
            registerHandler("/myget2", new BasicValidationHandler("GET", "q=Camel", null, getExpectedContent())).
            create();
    localServer.start();

    super.setUp();
}
项目:Camel    文件:HttpCamelHeadersTest.java   
@Before
@Override
public void setUp() throws Exception {
    Map<String, String> expectedHeaders = new HashMap<String, String>();
    expectedHeaders.put("TestHeader", "test");
    expectedHeaders.put("Accept-Language", "pl");

    localServer = ServerBootstrap.bootstrap().
            setHttpProcessor(getBasicHttpProcessor()).
            setConnectionReuseStrategy(getConnectionReuseStrategy()).
            setResponseFactory(getHttpResponseFactory()).
            setExpectationVerifier(getHttpExpectationVerifier()).
            setSslContext(getSSLContext()).
            registerHandler("/", new MyHeaderValidationHandler("GET", "HTTP/1.0", getExpectedContent(), expectedHeaders)).create();
    localServer.start();

    super.setUp();
}
项目:Camel    文件:HttpMethodsTest.java   
@Before
@Override
public void setUp() throws Exception {
    localServer = ServerBootstrap.bootstrap().
            setHttpProcessor(getBasicHttpProcessor()).
            setConnectionReuseStrategy(getConnectionReuseStrategy()).
            setResponseFactory(getHttpResponseFactory()).
            setExpectationVerifier(getHttpExpectationVerifier()).
            setSslContext(getSSLContext()).
            registerHandler("/get", new BasicValidationHandler("GET", null, null, getExpectedContent())).
            registerHandler("/patch", new BasicValidationHandler("PATCH", null, null, getExpectedContent())).
            registerHandler("/patch1", new BasicValidationHandler("PATCH", null, "rocks camel?", getExpectedContent())).
            registerHandler("/post", new BasicValidationHandler("POST", null, null, getExpectedContent())).
            registerHandler("/post1", new BasicValidationHandler("POST", null, null, getExpectedContent())).
            registerHandler("/put", new BasicValidationHandler("PUT", null, null, getExpectedContent())).
            registerHandler("/trace", new BasicValidationHandler("TRACE", null, null, getExpectedContent())).
            registerHandler("/options", new BasicValidationHandler("OPTIONS", null, null, getExpectedContent())).
            registerHandler("/delete", new BasicValidationHandler("DELETE", null, null, getExpectedContent())).
            registerHandler("/head", new BasicValidationHandler("HEAD", null, null, getExpectedContent())).create();
    localServer.start();

    super.setUp();
}
项目:Camel    文件:HttpProducerWithSystemPropertiesTest.java   
@Before
@Override
public void setUp() throws Exception {
    Map<String, String> expectedHeaders = new HashMap<>();
    expectedHeaders.put("User-Agent", "myCoolCamelCaseAgent");

    localServer = ServerBootstrap.bootstrap().
            setHttpProcessor(getBasicHttpProcessor()).
            setConnectionReuseStrategy(getConnectionReuseStrategy()).
            setResponseFactory(getHttpResponseFactory()).
            setExpectationVerifier(getHttpExpectationVerifier()).
            setSslContext(getSSLContext()).
            registerHandler("*", new HeaderValidationHandler("GET", null, null, getExpectedContent(), expectedHeaders)).create();
    localServer.start();

    super.setUp();
}
项目:Camel    文件:HttpBodyTest.java   
@Before
@Override
public void setUp() throws Exception {
    Map<String, String> expectedHeaders = new HashMap<String, String>();
    expectedHeaders.put("Content-Type", "image/jpeg");

    localServer = ServerBootstrap.bootstrap().
            setHttpProcessor(getBasicHttpProcessor()).
            setConnectionReuseStrategy(getConnectionReuseStrategy()).
            setResponseFactory(getHttpResponseFactory()).
            setExpectationVerifier(getHttpExpectationVerifier()).
            setSslContext(getSSLContext()).
            registerHandler("/post", new BasicValidationHandler("POST", null, getBody(), getExpectedContent())).
            registerHandler("/post1", new HeaderValidationHandler("POST", null, null, getExpectedContent(), expectedHeaders)).
            create();
    localServer.start();

    super.setUp();
}
项目:purecloud-iot    文件:LocalServerTestBase.java   
@Before
public void setUp() throws Exception {
    final SocketConfig socketConfig = SocketConfig.custom()
            .setSoTimeout(15000)
            .build();
    this.serverBootstrap = ServerBootstrap.bootstrap()
            .setSocketConfig(socketConfig)
            .setServerInfo(ORIGIN)
            .registerHandler("/echo/*", new EchoHandler())
            .registerHandler("/random/*", new RandomHandler());
    if (this.scheme.equals(ProtocolScheme.https)) {
        this.serverBootstrap.setSslContext(SSLTestContexts.createServerSSLContext());
    }

    this.connManager = new PoolingHttpClientConnectionManager();
    this.clientBuilder = HttpClientBuilder.create()
            .setDefaultSocketConfig(socketConfig)
            .setConnectionManager(this.connManager);
}
项目:purecloud-iot    文件:TestSSLSocketFactory.java   
@Test
public void testBasicSSL() throws Exception {
    this.server = ServerBootstrap.bootstrap()
            .setServerInfo(LocalServerTestBase.ORIGIN)
            .setSslContext(SSLTestContexts.createServerSSLContext())
            .create();
    this.server.start();

    final HttpContext context = new BasicHttpContext();
    final TestX509HostnameVerifier hostVerifier = new TestX509HostnameVerifier();
    final SSLConnectionSocketFactory socketFactory = new SSLConnectionSocketFactory(
            SSLTestContexts.createClientSSLContext(), hostVerifier);
    final Socket socket = socketFactory.createSocket(context);
    final InetSocketAddress remoteAddress = new InetSocketAddress("localhost", this.server.getLocalPort());
    final HttpHost target = new HttpHost("localhost", this.server.getLocalPort(), "https");
    final SSLSocket sslSocket = (SSLSocket) socketFactory.connectSocket(0, socket, target, remoteAddress, null, context);
    try {
        final SSLSession sslsession = sslSocket.getSession();

        Assert.assertNotNull(sslsession);
        Assert.assertTrue(hostVerifier.isFired());
    } finally {
        sslSocket.close();
    }
}
项目:purecloud-iot    文件:TestSSLSocketFactory.java   
@Test
public void testBasicDefaultHostnameVerifier() throws Exception {
    this.server = ServerBootstrap.bootstrap()
            .setServerInfo(LocalServerTestBase.ORIGIN)
            .setSslContext(SSLTestContexts.createServerSSLContext())
            .create();
    this.server.start();

    final HttpContext context = new BasicHttpContext();
    final SSLConnectionSocketFactory socketFactory = new SSLConnectionSocketFactory(
            SSLTestContexts.createClientSSLContext(), SSLConnectionSocketFactory.getDefaultHostnameVerifier());
    final Socket socket = socketFactory.createSocket(context);
    final InetSocketAddress remoteAddress = new InetSocketAddress("localhost", this.server.getLocalPort());
    final HttpHost target = new HttpHost("localhost", this.server.getLocalPort(), "https");
    final SSLSocket sslSocket = (SSLSocket) socketFactory.connectSocket(0, socket, target, remoteAddress, null, context);
    try {
        final SSLSession sslsession = sslSocket.getSession();

        Assert.assertNotNull(sslsession);
    } finally {
        sslSocket.close();
    }
}
项目:purecloud-iot    文件:TestSSLSocketFactory.java   
@Test
public void testClientAuthSSL() throws Exception {
    this.server = ServerBootstrap.bootstrap()
            .setServerInfo(LocalServerTestBase.ORIGIN)
            .setSslContext(SSLTestContexts.createServerSSLContext())
            .create();
    this.server.start();

    final HttpContext context = new BasicHttpContext();
    final TestX509HostnameVerifier hostVerifier = new TestX509HostnameVerifier();
    final SSLConnectionSocketFactory socketFactory = new SSLConnectionSocketFactory(
            SSLTestContexts.createClientSSLContext(), hostVerifier);
    final Socket socket = socketFactory.createSocket(context);
    final InetSocketAddress remoteAddress = new InetSocketAddress("localhost", this.server.getLocalPort());
    final HttpHost target = new HttpHost("localhost", this.server.getLocalPort(), "https");
    final SSLSocket sslSocket = (SSLSocket) socketFactory.connectSocket(0, socket, target, remoteAddress, null, context);
    try {
        final SSLSession sslsession = sslSocket.getSession();

        Assert.assertNotNull(sslsession);
        Assert.assertTrue(hostVerifier.isFired());
    } finally {
        sslSocket.close();
    }
}
项目:purecloud-iot    文件:TestSSLSocketFactory.java   
@Test(expected=SSLException.class)
public void testSSLTrustVerification() throws Exception {
    this.server = ServerBootstrap.bootstrap()
            .setServerInfo(LocalServerTestBase.ORIGIN)
            .setSslContext(SSLTestContexts.createServerSSLContext())
            .create();
    this.server.start();

    final HttpContext context = new BasicHttpContext();
    // Use default SSL context
    final SSLContext defaultsslcontext = SSLContexts.createDefault();

    final SSLConnectionSocketFactory socketFactory = new SSLConnectionSocketFactory(defaultsslcontext,
            NoopHostnameVerifier.INSTANCE);

    final Socket socket = socketFactory.createSocket(context);
    final InetSocketAddress remoteAddress = new InetSocketAddress("localhost", this.server.getLocalPort());
    final HttpHost target = new HttpHost("localhost", this.server.getLocalPort(), "https");
    final SSLSocket sslSocket = (SSLSocket) socketFactory.connectSocket(0, socket, target, remoteAddress, null, context);
    sslSocket.close();
}
项目:DataHubSystem    文件:TestInterruptibleHttpClient.java   
/**
 * Starts the HTTP server.
 *
 * @return the listening port.
 */
static int start () throws IOException
{

   server = ServerBootstrap.bootstrap ().registerHandler ("*",
         new HttpRequestHandler ()
         {

            @Override
            public void handle (HttpRequest request, HttpResponse response,
                  HttpContext context)
                  throws HttpException, IOException
            {

               response.setStatusCode (HttpStatus.SC_OK);
               response.setEntity (new StringEntity ("0123456789"));
            }
         })
         .create ();
   server.start ();

   return server.getLocalPort ();
}
项目:Photato    文件:Photato.java   
private static HttpServer getDefaultServer(Path folderRoot) {
    return ServerBootstrap.bootstrap()
            .setListenerPort(PhotatoConfig.serverPort)
            .setServerInfo(serverName)
            .setSocketConfig(getSocketConfig())
            .setExceptionLogger(new StdErrorExceptionLogger())
            .registerHandler("*", new LoadingHandler(folderRoot))
            .create();
}
项目:sling-org-apache-sling-testing-clients    文件:HttpServerRule.java   
@Override
protected void before() throws Throwable {
    final SocketConfig socketConfig = SocketConfig.custom().setSoTimeout(5000).build();
    serverBootstrap = ServerBootstrap.bootstrap().setSocketConfig(socketConfig).setServerInfo(ORIGIN);
    if(ProtocolScheme.https.equals(protocolScheme)) {
        serverBootstrap.setSslContext(SSLTestContexts.createServerSSLContext());
    }
    registerHandlers();
    server = serverBootstrap.create();
    server.start();
    host = new HttpHost("127.0.0.1", server.getLocalPort(), protocolScheme.name());
    uri = URIUtils.rewriteURI(new URI("/"), host);
}
项目:logregator    文件:HttpCollector.java   
public HttpCollector(Aggregator aggregator, HttpCollectorConfig config) {
    this.aggregator = aggregator;
    this.server = ServerBootstrap.bootstrap()
                                    .registerHandler(config.getUri(), new HttpCollectorHandler(this))
                                    .setListenerPort(config.getPort())
                                    .create();
    this.work = false;
}
项目:Camel    文件:HttpBridgeEndpointTest.java   
@Before
@Override
public void setUp() throws Exception {
    localServer = ServerBootstrap.bootstrap().
            setHttpProcessor(getBasicHttpProcessor()).
            setConnectionReuseStrategy(getConnectionReuseStrategy()).
            setResponseFactory(getHttpResponseFactory()).
            setExpectationVerifier(getHttpExpectationVerifier()).
            setSslContext(getSSLContext()).
            registerHandler("/", new BasicValidationHandler("GET", null, null, getExpectedContent())).
            registerHandler("/query", new BasicRawQueryValidationHandler("GET", "x=%3B", null, getExpectedContent())).create();
    localServer.start();

    super.setUp();
}
项目:Camel    文件:HttpPollingConsumerTest.java   
@Before
@Override
public void setUp() throws Exception {
    localServer = ServerBootstrap.bootstrap().
            setHttpProcessor(getBasicHttpProcessor()).
            setConnectionReuseStrategy(getConnectionReuseStrategy()).
            setResponseFactory(getHttpResponseFactory()).
            setExpectationVerifier(getHttpExpectationVerifier()).
            setSslContext(getSSLContext()).
            registerHandler("/", new DelayValidationHandler("GET", null, null, getExpectedContent(), 1000)).create();
    localServer.start();

    super.setUp();
}
项目:Camel    文件:HttpDefaultPortNumberTest.java   
@Before
@Override
public void setUp() throws Exception {
    localServer = ServerBootstrap.bootstrap().
            setHttpProcessor(getBasicHttpProcessor()).
            setConnectionReuseStrategy(getConnectionReuseStrategy()).
            setResponseFactory(getHttpResponseFactory()).
            setExpectationVerifier(getHttpExpectationVerifier()).
            setSslContext(getSSLContext()).
            registerHandler("/search", new BasicValidationHandler("GET", null, null, getExpectedContent())).create();
    localServer.start();

    super.setUp();
}
项目:Camel    文件:HttpCharsetTest.java   
@Before
@Override
public void setUp() throws Exception {
    localServer = ServerBootstrap.bootstrap().
            setHttpProcessor(getBasicHttpProcessor()).
            setConnectionReuseStrategy(getConnectionReuseStrategy()).
            setResponseFactory(getHttpResponseFactory()).
            setExpectationVerifier(getHttpExpectationVerifier()).
            setSslContext(getSSLContext()).
            registerHandler("/", new BasicValidationHandler("POST", null, getBody(), getExpectedContent())).create();
    localServer.start();

    super.setUp();
}
项目:Camel    文件:HttpProducerExplicitConnectionCloseTest.java   
@Before
@Override
public void setUp() throws Exception {
    localServer = ServerBootstrap.bootstrap().
            setHttpProcessor(getBasicHttpProcessor()).
            setConnectionReuseStrategy(getConnectionReuseStrategy()).
            setResponseFactory(getHttpResponseFactory()).
            setExpectationVerifier(getHttpExpectationVerifier()).
            setSslContext(getSSLContext()).
            registerHandler("/myget", new BasicValidationHandler("GET", null, null, getExpectedContent())).
            create();
    localServer.start();

    super.setUp();
}
项目:Camel    文件:HttpAuthenticationTest.java   
@Before
@Override
public void setUp() throws Exception {
    localServer = ServerBootstrap.bootstrap().
            setHttpProcessor(getBasicHttpProcessor()).
            setConnectionReuseStrategy(getConnectionReuseStrategy()).
            setResponseFactory(getHttpResponseFactory()).
            setExpectationVerifier(getHttpExpectationVerifier()).
            setSslContext(getSSLContext()).
            registerHandler("/search", new AuthenticationValidationHandler("GET", null, null, getExpectedContent(), user, password)).create();
    localServer.start();

    super.setUp();
}
项目:Camel    文件:HttpsTwoDifferentSslContextParametersGetTest.java   
@Before
@Override
public void setUp() throws Exception {
    localServer = ServerBootstrap.bootstrap().
            setHttpProcessor(getBasicHttpProcessor()).
            setConnectionReuseStrategy(getConnectionReuseStrategy()).
            setResponseFactory(getHttpResponseFactory()).
            setExpectationVerifier(getHttpExpectationVerifier()).
            setSslContext(getSSLContext()).
            create();
    localServer.start();

    super.setUp();
}
项目:Camel    文件:HttpsSslContextParametersGetTest.java   
@Before
@Override
public void setUp() throws Exception {
    localServer = ServerBootstrap.bootstrap().
            setHttpProcessor(getBasicHttpProcessor()).
            setConnectionReuseStrategy(getConnectionReuseStrategy()).
            setResponseFactory(getHttpResponseFactory()).
            setExpectationVerifier(getHttpExpectationVerifier()).
            setSslContext(getSSLContext()).
            registerHandler("/mail/", new BasicValidationHandler("GET", null, null, getExpectedContent())).create();
    localServer.start();

    super.setUp();
}
项目:Camel    文件:HttpNoConnectionTest.java   
@Before
@Override
public void setUp() throws Exception {
    localServer = ServerBootstrap.bootstrap().
            setHttpProcessor(getBasicHttpProcessor()).
            setConnectionReuseStrategy(getConnectionReuseStrategy()).
            setResponseFactory(getHttpResponseFactory()).
            setExpectationVerifier(getHttpExpectationVerifier()).
            setSslContext(getSSLContext()).
            registerHandler("/search", new BasicValidationHandler("GET", null, null, getExpectedContent())).create();
    localServer.start();

    super.setUp();
}
项目:Camel    文件:HttpsTwoComponentsSslContextParametersGetTest.java   
@Before
@Override
public void setUp() throws Exception {
    localServer = ServerBootstrap.bootstrap().
            setHttpProcessor(getBasicHttpProcessor()).
            setConnectionReuseStrategy(getConnectionReuseStrategy()).
            setResponseFactory(getHttpResponseFactory()).
            setExpectationVerifier(getHttpExpectationVerifier()).
            setSslContext(getSSLContext()).
            create();
    localServer.start();

    super.setUp();
}
项目:Camel    文件:HttpsAuthenticationTest.java   
@Before
@Override
public void setUp() throws Exception {
    localServer = ServerBootstrap.bootstrap().
            setHttpProcessor(getBasicHttpProcessor()).
            setConnectionReuseStrategy(getConnectionReuseStrategy()).
            setResponseFactory(getHttpResponseFactory()).
            setExpectationVerifier(getHttpExpectationVerifier()).
            setSslContext(getSSLContext()).
            registerHandler("/", new AuthenticationValidationHandler("GET", null, null, getExpectedContent(), user, password)).create();
    localServer.start();

    super.setUp();
}
项目:Camel    文件:HttpWithHttpUriHeaderTest.java   
@Before
@Override
public void setUp() throws Exception {
    localServer = ServerBootstrap.bootstrap().
            setHttpProcessor(getBasicHttpProcessor()).
            setConnectionReuseStrategy(getConnectionReuseStrategy()).
            setResponseFactory(getHttpResponseFactory()).
            setExpectationVerifier(getHttpExpectationVerifier()).
            setSslContext(getSSLContext()).
            registerHandler("/", new BasicValidationHandler("GET", null, null, getExpectedContent())).create();
    localServer.start();

    super.setUp();
}
项目:Camel    文件:HttpThrowExceptionOnFailureTest.java   
@Before
@Override
public void setUp() throws Exception {
    localServer = ServerBootstrap.bootstrap().
            setHttpProcessor(getBasicHttpProcessor()).
            setConnectionReuseStrategy(getConnectionReuseStrategy()).
            setResponseFactory(getHttpResponseFactory()).
            setExpectationVerifier(getHttpExpectationVerifier()).
            setSslContext(getSSLContext()).
            registerHandler("/", new BasicValidationHandler("GET", null, null, getExpectedContent())).create();
    localServer.start();

    super.setUp();
}
项目:Camel    文件:HttpSOTimeoutTest.java   
@Before
@Override
public void setUp() throws Exception {
    localServer = ServerBootstrap.bootstrap().
            setHttpProcessor(getBasicHttpProcessor()).
            setConnectionReuseStrategy(getConnectionReuseStrategy()).
            setResponseFactory(getHttpResponseFactory()).
            setExpectationVerifier(getHttpExpectationVerifier()).
            setSslContext(getSSLContext()).
            registerHandler("/", new DelayValidationHandler("GET", null, null, getExpectedContent(), 2000)).create();
    localServer.start();

    super.setUp();
}
项目:Camel    文件:HttpNoConnectionRedeliveryTest.java   
@Before
@Override
public void setUp() throws Exception {
    localServer = ServerBootstrap.bootstrap().
            setHttpProcessor(getBasicHttpProcessor()).
            setConnectionReuseStrategy(getConnectionReuseStrategy()).
            setResponseFactory(getHttpResponseFactory()).
            setExpectationVerifier(getHttpExpectationVerifier()).
            setSslContext(getSSLContext()).
            registerHandler("/search", new BasicValidationHandler("GET", null, null, getExpectedContent())).create();
    localServer.start();

    super.setUp();
}
项目:Camel    文件:HttpNoCamelHeaderTest.java   
@Before
@Override
public void setUp() throws Exception {
    localServer = ServerBootstrap.bootstrap().
            setHttpProcessor(getBasicHttpProcessor()).
            setConnectionReuseStrategy(getConnectionReuseStrategy()).
            setResponseFactory(getHttpResponseFactory()).
            setExpectationVerifier(getHttpExpectationVerifier()).
            setSslContext(getSSLContext()).
            registerHandler("/hello", new HttpRequestHandler() {
                @Override
                public void handle(HttpRequest request, HttpResponse response, HttpContext context) throws HttpException, IOException {
                    response.setStatusCode(HttpStatus.SC_OK);
                    Object header = request.getFirstHeader(Exchange.FILE_NAME);
                    assertNull("There should be no Camel header", header);

                    for (Header h : request.getAllHeaders()) {
                        if (h.getName().startsWith("Camel") || h.getName().startsWith("org.apache.camel")) {
                            assertNull("There should be no Camel header", h);
                        }
                    }

                    // set ar regular and Camel header
                    response.setHeader("MyApp", "dude");
                    response.setHeader(Exchange.TO_ENDPOINT, "foo");
                }
            }).create();
    localServer.start();

    super.setUp();
}
项目:Camel    文件:HttpDisableStreamCacheTest.java   
@Before
@Override
public void setUp() throws Exception {
    localServer = ServerBootstrap.bootstrap().
            setHttpProcessor(getBasicHttpProcessor()).
            setConnectionReuseStrategy(getConnectionReuseStrategy()).
            setResponseFactory(getHttpResponseFactory()).
            setExpectationVerifier(getHttpExpectationVerifier()).
            setSslContext(getSSLContext()).
            registerHandler("/test/", new BasicValidationHandler("GET", null, null, getExpectedContent())).
            create();
    localServer.start();

    super.setUp();
}