RequestContextCurrentTraceContext extends CurrentTraceContext { @Override public Scope newScope(@Nullable TraceContext currentSpan) { if (currentSpan != null && TraceContextUtil.PingPongExtra.maybeSetPong(currentSpan)) { return Scope.NOOP; } final RequestContext ctx = getRequestContextOrWarnOnce(); if (ctx != null && ctx.eventLoop().inEventLoop()) { return createScopeForRequestThread(ctx, currentSpan); } else { return createScopeForNonRequestThread(currentSpan); } } RequestContextCurrentTraceContext(
            CurrentTraceContext.Builder builder, List<Pattern> nonRequestThreadPatterns); static RequestContextCurrentTraceContext ofDefault(); static RequestContextCurrentTraceContextBuilder builder(); static void setCurrentThreadNotRequestThread(boolean value); @Override @Nullable TraceContext get(); @Override Scope newScope(@Nullable TraceContext currentSpan);  }
@Test public void newScope_respondsToPing() { final PingPongExtra extra = new PingPongExtra(); final TraceContext extraContext = TraceContext.newBuilder().traceId(1).spanId(1) .addExtra(extra).build(); try (Scope traceContextScope = currentTraceContext.newScope(extraContext)) { assertThat(traceContextScope).hasToString("NoopScope"); assertThat(extra.isPong()).isTrue(); } }