GrpcServerRequest extends RpcServerRequest implements GrpcRequest { @Override protected String propagationField(String keyName) { if (keyName == null) throw new NullPointerException("keyName == null"); Key<String> key = nameToKey.get(keyName); if (key == null) { assert false : "We currently don't support getting headers except propagation fields"; return null; } return headers.get(key); } GrpcServerRequest(Map<String, Key<String>> nameToKey, ServerCall<?, ?> call, Metadata headers); @Override Object unwrap(); @Override String method(); @Override String service(); ServerCall<?, ?> call(); @Override MethodDescriptor<?, ?> methodDescriptor(); @Override Metadata headers();  }
@Test public void propagationField() { headers.put(b3Key, "1"); assertThat(request.propagationField("b3")).isEqualTo("1"); }
@Test public void propagationField_null() { assertThat(request.propagationField("b3")).isNull(); }
@Test public void propagationField_lastValue() { headers.put(b3Key, "0"); headers.put(b3Key, "1"); assertThat(request.propagationField("b3")).isEqualTo("1"); }