Search in sources :

Example 6 with TransportDispatcherBuilder

use of com.linkedin.r2.transport.common.bridge.server.TransportDispatcherBuilder in project rest.li by linkedin.

the class TestDisruptor method setup.

@BeforeClass
public void setup() throws IOException {
    final TransportDispatcher dispatcher = new TransportDispatcherBuilder(REST_OVER_STREAM).addRestHandler(URI.create(PATH), new AbstractHttpServerTest.HeaderEchoHandler()).build();
    final HttpServerFactory factory = new HttpServerFactory();
    _server = factory.createH2cServer(PORT, dispatcher, REST_OVER_STREAM);
    _server.start();
}
Also used : HttpServerFactory(com.linkedin.r2.transport.http.server.HttpServerFactory) TransportDispatcher(com.linkedin.r2.transport.common.bridge.server.TransportDispatcher) TransportDispatcherBuilder(com.linkedin.r2.transport.common.bridge.server.TransportDispatcherBuilder) BeforeClass(org.testng.annotations.BeforeClass)

Example 7 with TransportDispatcherBuilder

use of com.linkedin.r2.transport.common.bridge.server.TransportDispatcherBuilder in project rest.li by linkedin.

the class TestHttp2Server method doSetup.

@Override
protected void doSetup() throws IOException {
    final TransportDispatcher dispatcher = new TransportDispatcherBuilder(_restOverStream).addRestHandler(URI.create("/error"), new ErrorHandler()).addRestHandler(URI.create("/headerEcho"), new HeaderEchoHandler()).addRestHandler(URI.create("/foobar"), new FoobarHandler(_scheduler)).build();
    _server = new HttpServerFactory(_servletType).createH2cServer(_port, dispatcher, _restOverStream);
    _server.start();
}
Also used : HttpServerFactory(com.linkedin.r2.transport.http.server.HttpServerFactory) TransportDispatcher(com.linkedin.r2.transport.common.bridge.server.TransportDispatcher) TransportDispatcherBuilder(com.linkedin.r2.transport.common.bridge.server.TransportDispatcherBuilder)

Example 8 with TransportDispatcherBuilder

use of com.linkedin.r2.transport.common.bridge.server.TransportDispatcherBuilder in project rest.li by linkedin.

the class TestHttpServer method doSetup.

@Override
protected void doSetup() throws IOException {
    final TransportDispatcher dispatcher = new TransportDispatcherBuilder(_restOverStream).addRestHandler(URI.create("/error"), new ErrorHandler()).addRestHandler(URI.create("/headerEcho"), new HeaderEchoHandler()).addRestHandler(URI.create("/foobar"), new FoobarHandler(_scheduler)).build();
    _server = new HttpServerFactory(_servletType).createServer(_port, dispatcher, _restOverStream);
    _server.start();
}
Also used : HttpServerFactory(com.linkedin.r2.transport.http.server.HttpServerFactory) TransportDispatcher(com.linkedin.r2.transport.common.bridge.server.TransportDispatcher) TransportDispatcherBuilder(com.linkedin.r2.transport.common.bridge.server.TransportDispatcherBuilder)

Example 9 with TransportDispatcherBuilder

use of com.linkedin.r2.transport.common.bridge.server.TransportDispatcherBuilder in project rest.li by linkedin.

the class TestMIMEChainingMultipleSources method setup.

@BeforeMethod
public void setup() throws IOException {
    _latch = new CountDownLatch(2);
    _clientFactory = new HttpClientFactory();
    _client = new TransportClientAdapter(_clientFactory.getClient(Collections.<String, String>emptyMap()));
    _server_A_client = new TransportClientAdapter(_clientFactory.getClient(Collections.<String, String>emptyMap()));
    final HttpServerFactory httpServerFactory = new HttpServerFactory();
    final ServerARequestHandler serverARequestHandler = new ServerARequestHandler();
    final TransportDispatcher serverATransportDispatcher = new TransportDispatcherBuilder().addStreamHandler(SERVER_A_URI, serverARequestHandler).build();
    final ServerBRequestHandler serverBRequestHandler = new ServerBRequestHandler();
    final TransportDispatcher serverBTransportDispatcher = new TransportDispatcherBuilder().addStreamHandler(SERVER_B_URI, serverBRequestHandler).build();
    _serverA = httpServerFactory.createServer(PORT_SERVER_A, serverATransportDispatcher, true);
    _serverB = httpServerFactory.createServer(PORT_SERVER_B, serverBTransportDispatcher, true);
    _serverA.start();
    _serverB.start();
}
Also used : HttpServerFactory(com.linkedin.r2.transport.http.server.HttpServerFactory) TransportClientAdapter(com.linkedin.r2.transport.common.bridge.client.TransportClientAdapter) TransportDispatcher(com.linkedin.r2.transport.common.bridge.server.TransportDispatcher) CountDownLatch(java.util.concurrent.CountDownLatch) HttpClientFactory(com.linkedin.r2.transport.http.client.HttpClientFactory) TransportDispatcherBuilder(com.linkedin.r2.transport.common.bridge.server.TransportDispatcherBuilder) BeforeMethod(org.testng.annotations.BeforeMethod)

Aggregations

TransportDispatcherBuilder (com.linkedin.r2.transport.common.bridge.server.TransportDispatcherBuilder)9 TransportDispatcher (com.linkedin.r2.transport.common.bridge.server.TransportDispatcher)8 HttpServerFactory (com.linkedin.r2.transport.http.server.HttpServerFactory)6 TransportClientAdapter (com.linkedin.r2.transport.common.bridge.client.TransportClientAdapter)3 None (com.linkedin.common.util.None)2 HttpClientFactory (com.linkedin.r2.transport.http.client.HttpClientFactory)2 HashMap (java.util.HashMap)2 Callback (com.linkedin.common.callback.Callback)1 FutureCallback (com.linkedin.common.callback.FutureCallback)1 ByteString (com.linkedin.data.ByteString)1 RequestContext (com.linkedin.r2.message.RequestContext)1 RestRequestBuilder (com.linkedin.r2.message.rest.RestRequestBuilder)1 RestResponse (com.linkedin.r2.message.rest.RestResponse)1 StreamRequest (com.linkedin.r2.message.stream.StreamRequest)1 StreamResponseBuilder (com.linkedin.r2.message.stream.StreamResponseBuilder)1 StreamRequestHandler (com.linkedin.r2.transport.common.StreamRequestHandler)1 CountDownLatch (java.util.concurrent.CountDownLatch)1 BeforeClass (org.testng.annotations.BeforeClass)1 BeforeMethod (org.testng.annotations.BeforeMethod)1 DataProvider (org.testng.annotations.DataProvider)1