@Test(expected = IOException.class)
public void testIOException() throws Throwable {

  byte[] arr = "{".getBytes();
  HttpClient client = getMockClientWithResponse(arr, ContentType.DEFAULT_BINARY,
      HttpStatus.SC_INTERNAL_SERVER_ERROR, false);
  doThrow(new IOException()).when(client).execute(any(HttpPost.class));
  HttpTransport transport = new HttpTransport(client, "", true, 3, 1);
  try {
    transport.sendBatch("foo".getBytes());
  } catch (Exception e) {
    throw e.getCause().getCause();
  }
}