@Test public void transportHeadersReceived_doesntRequire200() { BaseTransportState state = new BaseTransportState(transportTracer); state.setListener(mockListener); Metadata headers = new Metadata(); headers.put(testStatusMashaller, "500"); headers.put(Metadata.Key.of("content-type", Metadata.ASCII_STRING_MARSHALLER), "application/grpc"); state.transportHeadersReceived(headers); verify(mockListener, never()).closed(any(Status.class), same(PROCESSED), any(Metadata.class)); verify(mockListener).headersRead(headers); }
protected void transportHeadersReceived(Metadata headers) { Preconditions.checkNotNull(headers, "headers"); if (transportError != null) { transportError = transportError.augmentDescription("headers: " + headers); return; } try { if (headersReceived) { transportError = Status.INTERNAL.withDescription("Received headers twice"); return; } Integer httpStatus = headers.get(HTTP2_STATUS); if (httpStatus != null && httpStatus >= 100 && httpStatus < 200) { return; } headersReceived = true; transportError = validateInitialMetadata(headers); if (transportError != null) { return; } stripTransportDetails(headers); inboundHeadersReceived(headers); } finally { if (transportError != null) { transportError = transportError.augmentDescription("headers: " + headers); transportErrorMetadata = headers; errorCharset = extractCharset(headers); } } }
Http2ClientStreamTransportState extends AbstractClientStream.TransportState { protected void transportHeadersReceived(Metadata headers) { Preconditions.checkNotNull(headers, "headers"); if (transportError != null) { transportError = transportError.augmentDescription("headers: " + headers); return; } try { if (headersReceived) { transportError = Status.INTERNAL.withDescription("Received headers twice"); return; } Integer httpStatus = headers.get(HTTP2_STATUS); if (httpStatus != null && httpStatus >= 100 && httpStatus < 200) { return; } headersReceived = true; transportError = validateInitialMetadata(headers); if (transportError != null) { return; } stripTransportDetails(headers); inboundHeadersReceived(headers); } finally { if (transportError != null) { transportError = transportError.augmentDescription("headers: " + headers); transportErrorMetadata = headers; errorCharset = extractCharset(headers); } } } }
Http2ClientStreamTransportState extends AbstractClientStream.TransportState { protected void transportHeadersReceived(Metadata headers) { Preconditions.checkNotNull(headers, "headers"); if (transportError != null) { transportError = transportError.augmentDescription("headers: " + headers); return; } try { if (headersReceived) { transportError = Status.INTERNAL.withDescription("Received headers twice"); return; } Integer httpStatus = headers.get(HTTP2_STATUS); if (httpStatus != null && httpStatus >= 100 && httpStatus < 200) { return; } headersReceived = true; transportError = validateInitialMetadata(headers); if (transportError != null) { return; } stripTransportDetails(headers); inboundHeadersReceived(headers); } finally { if (transportError != null) { transportError = transportError.augmentDescription("headers: " + headers); transportErrorMetadata = headers; errorCharset = extractCharset(headers); } } } protected  Http2ClientStreamTransportState(
      int maxMessageSize,
      StatsTraceContext statsTraceCtx,
      TransportTracer transportTracer); }
Http2ClientStreamTransportState extends AbstractClientStream.TransportState { protected void transportHeadersReceived(Metadata headers) { Preconditions.checkNotNull(headers, "headers"); if (transportError != null) { transportError = transportError.augmentDescription("headers: " + headers); return; } try { if (headersReceived) { transportError = Status.INTERNAL.withDescription("Received headers twice"); return; } Integer httpStatus = headers.get(HTTP2_STATUS); if (httpStatus != null && httpStatus >= 100 && httpStatus < 200) { return; } headersReceived = true; transportError = validateInitialMetadata(headers); if (transportError != null) { return; } stripTransportDetails(headers); inboundHeadersReceived(headers); } finally { if (transportError != null) { transportError = transportError.augmentDescription("headers: " + headers); transportErrorMetadata = headers; errorCharset = extractCharset(headers); } } } protected  Http2ClientStreamTransportState(
      int maxMessageSize,
      StatsTraceContext statsTraceCtx,
      TransportTracer transportTracer);  }
Http2ClientStreamTransportState extends AbstractClientStream.TransportState { protected void transportHeadersReceived(Metadata headers) { Preconditions.checkNotNull(headers, "headers"); if (transportError != null) { transportError = transportError.augmentDescription("headers: " + headers); return; } try { if (headersReceived) { transportError = Status.INTERNAL.withDescription("Received headers twice"); return; } Integer httpStatus = headers.get(HTTP2_STATUS); if (httpStatus != null && httpStatus >= 100 && httpStatus < 200) { return; } headersReceived = true; transportError = validateInitialMetadata(headers); if (transportError != null) { return; } stripTransportDetails(headers); inboundHeadersReceived(headers); } finally { if (transportError != null) { transportError = transportError.augmentDescription("headers: " + headers); transportErrorMetadata = headers; errorCharset = extractCharset(headers); } } } protected  Http2ClientStreamTransportState(
      int maxMessageSize,
      StatsTraceContext statsTraceCtx,
      TransportTracer transportTracer);   }