@Test
public void testCopyFromHostBogusHeader() throws Exception {

  Fetcher<Text,Text> underTest = new FakeFetcher<Text,Text>(job, id, ss, mm,
      r, metrics, except, key, connection);
  String replyHash = SecureShuffleUtils.generateHash(encHash.getBytes(), key);
  
  when(connection.getResponseCode()).thenReturn(200);
  when(connection.getHeaderField(ShuffleHeader.HTTP_HEADER_NAME))
      .thenReturn(ShuffleHeader.DEFAULT_HTTP_HEADER_NAME);
  when(connection.getHeaderField(ShuffleHeader.HTTP_HEADER_VERSION))
      .thenReturn(ShuffleHeader.DEFAULT_HTTP_HEADER_VERSION);
  when(connection.getHeaderField(SecureShuffleUtils.HTTP_HEADER_REPLY_URL_HASH))
      .thenReturn(replyHash);
  ByteArrayInputStream in = new ByteArrayInputStream(
      "\u00010 BOGUS DATA\nBOGUS DATA\nBOGUS DATA\n".getBytes());
  when(connection.getInputStream()).thenReturn(in);
  
  underTest.copyFromHost(host);
  
  verify(connection).addRequestProperty(
      SecureShuffleUtils.HTTP_HEADER_URL_HASH, encHash);
  
  verify(allErrs).increment(1);
  verify(ss).copyFailed(map1ID, host, true, false);
  verify(ss).copyFailed(map2ID, host, true, false);
  
  verify(ss).putBackKnownMapOutput(any(MapHost.class), eq(map1ID));
  verify(ss).putBackKnownMapOutput(any(MapHost.class), eq(map2ID));
}