@Test
public void testCopyFromHostIncompatibleShuffleVersion() throws Exception {

  String replyHash = SecureShuffleUtils.generateHash(encHash.getBytes(), key);
  
  when(connection.getResponseCode()).thenReturn(200);
  when(connection.getHeaderField(ShuffleHeader.HTTP_HEADER_NAME))
      .thenReturn("mapreduce").thenReturn("other").thenReturn("other");
  when(connection.getHeaderField(ShuffleHeader.HTTP_HEADER_VERSION))
      .thenReturn("1.0.1").thenReturn("1.0.0").thenReturn("1.0.1");
  when(connection.getHeaderField(
      SecureShuffleUtils.HTTP_HEADER_REPLY_URL_HASH)).thenReturn(replyHash);
  ByteArrayInputStream in = new ByteArrayInputStream(new byte[0]);
  when(connection.getInputStream()).thenReturn(in);
  for (int i = 0; i < 3; ++i) {
    Fetcher<Text,Text> underTest = new FakeFetcher<Text,Text>(job, id, ss, mm,
        r, metrics, except, key, connection);
    underTest.copyFromHost(host);
  }
  
  verify(connection, times(3)).addRequestProperty(
      SecureShuffleUtils.HTTP_HEADER_URL_HASH, encHash);
  
  verify(allErrs, times(3)).increment(1);
  verify(ss, times(3)).copyFailed(map1ID, host, false, false);
  verify(ss, times(3)).copyFailed(map2ID, host, false, false);
  
  verify(ss, times(3)).putBackKnownMapOutput(any(MapHost.class), eq(map1ID));
  verify(ss, times(3)).putBackKnownMapOutput(any(MapHost.class), eq(map2ID));
}