Search in sources :

Example 1 with TimingContext

use of com.linkedin.r2.message.timing.TimingContextUtil.TimingContext in project rest.li by linkedin.

the class TestSslTimingKey method testSslTimingKey.

@Test
public void testSslTimingKey() throws Exception {
    if (isHttp2StreamBasedChannel())
        return;
    final EchoService client = new RestEchoClient(Bootstrap.createURI(_port, Bootstrap.getEchoURI(), true), createClient());
    final String msg = "This is a simple http echo message";
    final FutureCallback<String> callback = new FutureCallback<>();
    client.echo(msg, callback);
    Assert.assertEquals(callback.get(), msg);
    RequestContext context = _clientCaptureFilter.getRequestContext();
    @SuppressWarnings("unchecked") Map<TimingKey, TimingContext> map = (Map<TimingKey, TimingContext>) context.getLocalAttr("timings");
    Assert.assertNotNull(map);
    Assert.assertTrue(map.containsKey(SslHandshakeTimingHandler.TIMING_KEY));
    TimingContext timingContext = map.get(SslHandshakeTimingHandler.TIMING_KEY);
    Assert.assertNotNull(timingContext);
}
Also used : TimingKey(com.linkedin.r2.message.timing.TimingKey) EchoService(com.linkedin.r2.sample.echo.EchoService) RestEchoClient(com.linkedin.r2.sample.echo.rest.RestEchoClient) RequestContext(com.linkedin.r2.message.RequestContext) Map(java.util.Map) FutureCallback(com.linkedin.common.callback.FutureCallback) TimingContext(com.linkedin.r2.message.timing.TimingContextUtil.TimingContext) AbstractEchoServiceTest(test.r2.integ.clientserver.providers.AbstractEchoServiceTest) Test(org.testng.annotations.Test)

Aggregations

FutureCallback (com.linkedin.common.callback.FutureCallback)1 RequestContext (com.linkedin.r2.message.RequestContext)1 TimingContext (com.linkedin.r2.message.timing.TimingContextUtil.TimingContext)1 TimingKey (com.linkedin.r2.message.timing.TimingKey)1 EchoService (com.linkedin.r2.sample.echo.EchoService)1 RestEchoClient (com.linkedin.r2.sample.echo.rest.RestEchoClient)1 Map (java.util.Map)1 Test (org.testng.annotations.Test)1 AbstractEchoServiceTest (test.r2.integ.clientserver.providers.AbstractEchoServiceTest)1