@Test(expected = TransportException.class)
public void testErrorsResponse() throws TransportException, IOException {

  byte[] respPayload = "resp".getBytes(StandardCharsets.UTF_8);
  HttpClient client = getMockClientWithResponse(respPayload, ContentType.APPLICATION_JSON,
      HttpStatus.SC_INTERNAL_SERVER_ERROR, false);
  HttpTransport transport = new HttpTransport(client, "", false, 1, 1);
  try {
    transport.sendBatch("foo".getBytes());
  } catch (Exception e) {
    assertEquals(
        "http transport call failed because \"expected failure\" payload response \"resp\"",
        e.getCause().getMessage());
    throw e;
  }
}