Called by subclasses whenever {@code Headers} are received from the transport.

@param headers the received headers
968875
protected void transportHeadersReceived(Metadata headers) {
    Preconditions.checkNotNull(headers, "headers");
    if (transportError != null) {
      // Already received a transport error so just augment it. Something is really, really strange.
      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) {
        // Ignore the headers. See RFC 7540 §8.1
        return;
      }
      headersReceived = true;

      transportError = validateInitialMetadata(headers);
      if (transportError != null) {
        return;
      }

      stripTransportDetails(headers);
      inboundHeadersReceived(headers);
    } finally {
      if (transportError != null) {
        // Note we don't immediately report the transport error, instead we wait for more data on
        // the stream so we can accumulate more detail into the error before reporting it.
        transportError = transportError.augmentDescription("headers: " + headers);
        transportErrorMetadata = headers;
        errorCharset = extractCharset(headers);
      }
    }
  }
666413
public void setAllowHeaders(String... headers) {
        allowHeadersSet.clear();
        for (String header : headers) {
            allowHeadersSet.add(header.toLowerCase());
        }
        allowHeaders = Joiner.on(",").join(headers);
    }
381420
public void writeHeader( DataOutputStream out ) 
                           throws IOException { 
    out.writeByte( type );
    out.writeInt( bytesPerChecksum );
  }
776382
public T header(Map<String, List<String>> headers) {
		return header(headers, false);
	}
385072
public void setLoadBalancerAddresses(java.util.Collection<LoadBalancerAddress> loadBalancerAddresses) {
        if (loadBalancerAddresses == null) {
            this.loadBalancerAddresses = null;
            return;
        }

        this.loadBalancerAddresses = new java.util.ArrayList<LoadBalancerAddress>(loadBalancerAddresses);
    }
360373
public void setHeaders(final Set<String> names) {
        // transform to lower-case because header names should be case-insensitive
        Set<String> lowerCaseNames = new HashSet<>();
        for (String name: names) {
            lowerCaseNames.add(name.toLowerCase());
        }
        this.headerNames = lowerCaseNames;
    }
644626
private boolean checkRequestHeaders(HeaderMap headers) {
        // :method pseudo-header must be present always exactly one time;
        // HTTP2 request MUST NOT contain 'connection' header
        if (headers.count(METHOD) != 1 || headers.contains(Headers.CONNECTION)) {
            return false;
        }

        // if CONNECT type is used, then we expect :method and :authority to be present only;
        // :scheme and :path must not be present
        if (headers.get(METHOD).contains(Methods.CONNECT_STRING)) {
            if (headers.contains(SCHEME) || headers.contains(PATH) || headers.count(AUTHORITY) != 1) {
                return false;
            }
        // For other HTTP methods we expect that :scheme, :method, and :path pseudo-headers are
        // present exactly one time.
        } else if (headers.count(SCHEME) != 1 || headers.count(PATH) != 1) {
            return false;
        }

        // HTTP2 request MAY contain TE header but if so, then only with 'trailers' value.
        if (headers.contains(Headers.TE)) {
            for (String value : headers.get(Headers.TE)) {
                if (!value.equals("trailers")) {
                    return false;
                }
            }
        }

        return true;
    }
684462
@Override
  public void clearHeaders(BindingProvider soapClient) {
    getContextHandlerFromClient(soapClient).clearHeaders();
    soapClient.getRequestContext().put(MessageContext.HTTP_REQUEST_HEADERS,
        new HashMap<String, List<String>>());
  }
494402
private void addHeaderList(Map<String, List<String>> headers, String name, String value) {

        List<String> values = headers.get(name);
        if (values == null) {
            values = new ArrayList<String>();
            headers.put(name, values);
        }
        values.add(value);
    }
600081
public void setHttpHeaders(java.util.Collection<HttpHeader> httpHeaders) {
        if (httpHeaders == null) {
            this.httpHeaders = null;
            return;
        }

        this.httpHeaders = new java.util.ArrayList<HttpHeader>(httpHeaders);
    }
917235
public final void setHeaderProperties(Properties headerProperties)
    {
        this.headerProperties=null;
        if(headerProperties!=null)
        {
            this.headerProperties=new Properties();
            this.headerProperties.putAll(headerProperties);
        }
    }
831324
public OkRequest<T> headers(final Map<String, String> headers) {
        if (!headers.isEmpty())
            for (Map.Entry<String, String> header : headers.entrySet())
                header(header);
        return this;
    }
1226551
protected function sendHttpHeaders(iterable $headers):void
    {
        foreach ($headers as $header => $value) {
            header("$header: $value", false);
        }
    }
551464
@SafeVarargs
    public final RequestBuilder headers(Map.Entry<String, ?>... headers) {
        headers(Lists.of(headers));
        return this;
    }
1333244
protected HttpHeaders copy(HttpHeaders headers){
		HttpHeaders newHeaders = new HttpHeaders();
		newHeaders.putAll(headers);
		return newHeaders;
	}
859632
public void setRoutes(java.util.Collection<RouteRef> routes) {
        if (routes == null) {
            this.routes = null;
            return;
        }

        this.routes = new java.util.ArrayList<RouteRef>(routes);
    }
638895
public final B addHeaders(Headers<AsciiString, String, ?> headers) {
        requireNonNull(headers, "headers");
        getOrCreateHeaders().add(headers);
        return self();
    }