@Test @SuppressWarnings("UndefinedEquals") public void convertServerHeaders_sanitizes() { Metadata metaData = new Metadata(); metaData.put(GrpcUtil.CONTENT_TYPE_KEY, "to-be-removed"); metaData.put(GrpcUtil.TE_HEADER, "to-be-removed"); metaData.put(GrpcUtil.USER_AGENT_KEY, "to-be-removed"); metaData.put(userKey, userValue); Http2Headers output = Utils.convertServerHeaders(metaData); DefaultHttp2Headers headers = new DefaultHttp2Headers(); for (Map.Entry<CharSequence, CharSequence> entry : output) { headers.add(entry.getKey(), entry.getValue()); } assertEquals(2 + 1, headers.size()); assertEquals(Utils.CONTENT_TYPE_GRPC, headers.get(GrpcUtil.CONTENT_TYPE_KEY.name())); }
public static Http2Headers convertServerHeaders(Metadata headers) { headers.discardAll(CONTENT_TYPE_KEY); headers.discardAll(GrpcUtil.TE_HEADER); headers.discardAll(GrpcUtil.USER_AGENT_KEY); return GrpcHttp2OutboundHeaders.serverResponseHeaders(toHttp2Headers(headers)); }
Utils { public static Http2Headers convertServerHeaders(Metadata headers) { headers.discardAll(CONTENT_TYPE_KEY); headers.discardAll(GrpcUtil.TE_HEADER); headers.discardAll(GrpcUtil.USER_AGENT_KEY); return GrpcHttp2OutboundHeaders.serverResponseHeaders(toHttp2Headers(headers)); } }
Utils { public static Http2Headers convertServerHeaders(Metadata headers) { headers.discardAll(CONTENT_TYPE_KEY); headers.discardAll(GrpcUtil.TE_HEADER); headers.discardAll(GrpcUtil.USER_AGENT_KEY); return GrpcHttp2OutboundHeaders.serverResponseHeaders(toHttp2Headers(headers)); } private  Utils(); }
Utils { public static Http2Headers convertServerHeaders(Metadata headers) { headers.discardAll(CONTENT_TYPE_KEY); headers.discardAll(GrpcUtil.TE_HEADER); headers.discardAll(GrpcUtil.USER_AGENT_KEY); return GrpcHttp2OutboundHeaders.serverResponseHeaders(toHttp2Headers(headers)); } private  Utils(); static Metadata convertHeaders(Http2Headers http2Headers); static Http2Headers convertClientHeaders(Metadata headers,
      AsciiString scheme,
      AsciiString defaultPath,
      AsciiString authority,
      AsciiString method,
      AsciiString userAgent); static Http2Headers convertServerHeaders(Metadata headers); static Metadata convertTrailers(Http2Headers http2Headers); static Http2Headers convertTrailers(Metadata trailers, boolean headersSent); static Status statusFromThrowable(Throwable t); }
Utils { public static Http2Headers convertServerHeaders(Metadata headers) { headers.discardAll(CONTENT_TYPE_KEY); headers.discardAll(GrpcUtil.TE_HEADER); headers.discardAll(GrpcUtil.USER_AGENT_KEY); return GrpcHttp2OutboundHeaders.serverResponseHeaders(toHttp2Headers(headers)); } private  Utils(); static Metadata convertHeaders(Http2Headers http2Headers); static Http2Headers convertClientHeaders(Metadata headers,
      AsciiString scheme,
      AsciiString defaultPath,
      AsciiString authority,
      AsciiString method,
      AsciiString userAgent); static Http2Headers convertServerHeaders(Metadata headers); static Metadata convertTrailers(Http2Headers http2Headers); static Http2Headers convertTrailers(Metadata trailers, boolean headersSent); static Status statusFromThrowable(Throwable t); static final AsciiString STATUS_OK; static final AsciiString HTTP_METHOD; static final AsciiString HTTP_GET_METHOD; static final AsciiString HTTPS; static final AsciiString HTTP; static final AsciiString CONTENT_TYPE_HEADER; static final AsciiString CONTENT_TYPE_GRPC; static final AsciiString TE_HEADER; static final AsciiString TE_TRAILERS; static final AsciiString USER_AGENT; static final Resource<EventLoopGroup> DEFAULT_BOSS_EVENT_LOOP_GROUP; static final Resource<EventLoopGroup> DEFAULT_WORKER_EVENT_LOOP_GROUP; }