@Deprecated
  public static StreamException buildStreamException(RestLiResponseException restLiResponseException, StreamDataCodec codec)
  {
    RestLiResponse restLiResponse = restLiResponseException.getRestLiResponse();
    StreamResponseBuilder responseBuilder = new StreamResponseBuilder()
        .setHeaders(restLiResponse.getHeaders())
        .setCookies(CookieUtil.encodeSetCookies(restLiResponse.getCookies()))
        .setStatus(restLiResponse.getStatus() == null ? HttpStatus.S_500_INTERNAL_SERVER_ERROR.getCode()
            : restLiResponse.getStatus().getCode());

    EntityStream<ByteString> entityStream = codec.encodeMap(restLiResponse.getDataMap());
    StreamResponse response = responseBuilder.build(EntityStreamAdapters.fromGenericEntityStream(entityStream));
    return new StreamException(response, restLiResponseException.getCause());
  }
@Test
  public void testContentTypeHeaderForStreamException()
  {
    RestLiResponseException restLiResponseException = new RestLiResponseException(
        new RuntimeException("this is a test"),
        new RestLiResponse.Builder()
            .status(HttpStatus.S_500_INTERNAL_SERVER_ERROR)
            .entity(new TestRecord())
            .headers(Collections.emptyMap())
            .cookies(Collections.emptyList())
            .build());

    StreamException streamException = ResponseUtils.buildStreamException(restLiResponseException, ContentType.PROTOBUF2);

    Assert.assertEquals(streamException.getResponse().getHeader(RestConstants.HEADER_CONTENT_TYPE),
        ContentType.PROTOBUF2.getHeaderKey());
  }