### Question:
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);   }### Answer:
@Test public void transportHeadersReceived_notifiesListener() { BaseTransportState state = new BaseTransportState(transportTracer); state.setListener(mockListener); Metadata headers = new Metadata(); headers.put(testStatusMashaller, "200"); 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); }
@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); }
@Test public void transportHeadersReceived_handles_1xx() { BaseTransportState state = new BaseTransportState(transportTracer); state.setListener(mockListener); Metadata infoHeaders = new Metadata(); infoHeaders.put(testStatusMashaller, "100"); state.transportHeadersReceived(infoHeaders); Metadata infoHeaders2 = new Metadata(); infoHeaders2.put(testStatusMashaller, "101"); state.transportHeadersReceived(infoHeaders2); Metadata headers = new Metadata(); headers.put(testStatusMashaller, "200"); 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); }