use of com.linkedin.r2.transport.common.StreamRequestHandlerAdapter in project rest.li by linkedin.
the class TestStreamEcho method getHandlers.
protected Map<URI, StreamRequestHandler> getHandlers() {
Map<URI, StreamRequestHandler> handlers = new HashMap<URI, StreamRequestHandler>();
handlers.put(ECHO_URI, new SteamEchoHandler());
handlers.put(ASYNC_ECHO_URI, new SteamAsyncEchoHandler(_scheduler));
handlers.put(DELAYED_ECHO_URI, new StreamRequestHandlerAdapter(new DelayedStoreAndForwardEchoHandler()));
return handlers;
}
use of com.linkedin.r2.transport.common.StreamRequestHandlerAdapter in project rest.li by linkedin.
the class TestQueryTunnel method setUp.
@BeforeClass
protected void setUp() throws Exception {
Map<String, String> clientProperties = new HashMap<String, String>();
clientProperties.put(HttpClientFactory.HTTP_QUERY_POST_THRESHOLD, String.valueOf(QUERY_TUNNEL_THRESHOLD));
clientProperties.put(HttpClientFactory.HTTP_PROTOCOL_VERSION, _httpProtocolVersion);
_clientFactory = new HttpClientFactory();
final TransportClient transportClient = _clientFactory.getClient(clientProperties);
_client = new TransportClientAdapter(transportClient, _clientROS);
final RestRequestHandler restHandler = new CheckQueryTunnelHandler();
final StreamRequestHandler streamHandler = new StreamRequestHandlerAdapter(restHandler);
TransportDispatcher dispatcher = new TransportDispatcher() {
@Override
public void handleRestRequest(RestRequest req, Map<String, String> wireAttrs, RequestContext requestContext, TransportCallback<RestResponse> callback) {
restHandler.handleRequest(req, requestContext, new TransportCallbackAdapter<RestResponse>(callback));
}
@Override
public void handleStreamRequest(StreamRequest req, Map<String, String> wireAttrs, RequestContext requestContext, TransportCallback<StreamResponse> callback) {
streamHandler.handleRequest(req, requestContext, new TransportCallbackAdapter<StreamResponse>(callback));
}
};
_server = new HttpServerFactory(_servletType).createH2cServer(_port, dispatcher, _serverROS);
_server.start();
}
Aggregations