@Test public void start_userAgentRemoved() { Metadata metaData = new Metadata(); metaData.put(GrpcUtil.USER_AGENT_KEY, "misbehaving-application"); stream = new OkHttpClientStream(methodDescriptor, metaData, frameWriter, transport, flowController, lock, MAX_MESSAGE_SIZE, INITIAL_WINDOW_SIZE, "localhost", "good-application", StatsTraceContext.NOOP, transportTracer, CallOptions.DEFAULT); stream.start(new BaseClientStreamListener()); stream.transportState().start(3); verify(frameWriter).synStream(eq(false), eq(false), eq(3), eq(0), headersCaptor.capture()); assertThat(headersCaptor.getValue()) .contains(new Header(GrpcUtil.USER_AGENT_KEY.name(), "good-application")); }
@Override protected TransportState transportState() { return state; }
OkHttpClientStream extends AbstractClientStream { @Override protected TransportState transportState() { return state; } }
OkHttpClientStream extends AbstractClientStream { @Override protected TransportState transportState() { return state; } OkHttpClientStream(
      MethodDescriptor<?, ?> method,
      Metadata headers,
      AsyncFrameWriter frameWriter,
      OkHttpClientTransport transport,
      OutboundFlowController outboundFlow,
      Object lock,
      int maxMessageSize,
      int initialWindowSize,
      String authority,
      String userAgent,
      StatsTraceContext statsTraceCtx,
      TransportTracer transportTracer,
      CallOptions callOptions); }
OkHttpClientStream extends AbstractClientStream { @Override protected TransportState transportState() { return state; } OkHttpClientStream(
      MethodDescriptor<?, ?> method,
      Metadata headers,
      AsyncFrameWriter frameWriter,
      OkHttpClientTransport transport,
      OutboundFlowController outboundFlow,
      Object lock,
      int maxMessageSize,
      int initialWindowSize,
      String authority,
      String userAgent,
      StatsTraceContext statsTraceCtx,
      TransportTracer transportTracer,
      CallOptions callOptions); MethodDescriptor.MethodType getType(); int id(); @Override void setAuthority(String authority); @Override Attributes getAttributes(); }
OkHttpClientStream extends AbstractClientStream { @Override protected TransportState transportState() { return state; } OkHttpClientStream(
      MethodDescriptor<?, ?> method,
      Metadata headers,
      AsyncFrameWriter frameWriter,
      OkHttpClientTransport transport,
      OutboundFlowController outboundFlow,
      Object lock,
      int maxMessageSize,
      int initialWindowSize,
      String authority,
      String userAgent,
      StatsTraceContext statsTraceCtx,
      TransportTracer transportTracer,
      CallOptions callOptions); MethodDescriptor.MethodType getType(); int id(); @Override void setAuthority(String authority); @Override Attributes getAttributes(); static final int ABSENT_ID; }