use of com.linkedin.r2.transport.common.bridge.server.TransportDispatcher in project rest.li by linkedin.
the class TestJetty404 method setup.
@BeforeClass
public void setup() throws IOException {
_clientFactory = new HttpClientFactory();
_client = new TransportClientAdapter(_clientFactory.getClient(Collections.<String, String>emptyMap()), true);
_server = new HttpServerFactory().createH2cServer(PORT, "/correct-path", 50, new TransportDispatcher() {
@Override
public void handleRestRequest(RestRequest req, Map<String, String> wireAttrs, RequestContext requestContext, TransportCallback<RestResponse> callback) {
callback.onResponse(TransportResponseImpl.success(new RestResponseBuilder().build()));
}
@Override
public void handleStreamRequest(StreamRequest req, Map<String, String> wireAttrs, RequestContext requestContext, TransportCallback<StreamResponse> callback) {
req.getEntityStream().setReader(new DrainReader());
callback.onResponse(TransportResponseImpl.success(new StreamResponseBuilder().build(EntityStreams.emptyStream())));
}
}, true);
_server.start();
}
use of com.linkedin.r2.transport.common.bridge.server.TransportDispatcher 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();
}
use of com.linkedin.r2.transport.common.bridge.server.TransportDispatcher 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();
}
use of com.linkedin.r2.transport.common.bridge.server.TransportDispatcher 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();
}
use of com.linkedin.r2.transport.common.bridge.server.TransportDispatcher 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();
}
Aggregations