### Question:
DigestScheme implements AuthScheme, Serializable { static String formatHex(final byte[] binaryData) { final int n = binaryData.length; final char[] buffer = new char[n * 2]; for (int i = 0; i < n; i++) { final int low = (binaryData[i] & 0x0f); final int high = ((binaryData[i] & 0xf0) >> 4); buffer[i * 2] = HEXADECIMAL[high]; buffer[(i * 2) + 1] = HEXADECIMAL[low]; } return new String(buffer); } DigestScheme();  DigestScheme(final Charset charset); void initPreemptive(final Credentials credentials, final String cnonce, final String realm); @Override String getName(); @Override boolean isConnectionBased(); @Override String getRealm(); @Override void processChallenge(
            final AuthChallenge authChallenge,
            final HttpContext context); @Override boolean isChallengeComplete(); @Override boolean isResponseReady(
            final HttpHost host,
            final CredentialsProvider credentialsProvider,
            final HttpContext context); @Override Principal getPrincipal(); @Override String generateAuthResponse(
            final HttpHost host,
            final HttpRequest request,
            final HttpContext context); @Internal String getNonce(); @Internal long getNounceCount(); @Internal String getCnonce(); @Override String toString();  }### Answer:
@Test public void testHttpEntityDigest() throws Exception { final HttpEntityDigester digester = new HttpEntityDigester(MessageDigest.getInstance("MD5")); Assert.assertNull(digester.getDigest()); digester.write('a'); digester.write('b'); digester.write('c'); digester.write(0xe4); digester.write(0xf6); digester.write(0xfc); digester.write(new byte[] { 'a', 'b', 'c'}); Assert.assertNull(digester.getDigest()); digester.close(); Assert.assertEquals("acd2b59cd01c7737d8069015584c6cac", DigestScheme.formatHex(digester.getDigest())); try { digester.write('a'); Assert.fail("IOException should have been thrown"); } catch (final IOException ex) { } try { digester.write(new byte[] { 'a', 'b', 'c'}); Assert.fail("IOException should have been thrown"); } catch (final IOException ex) { } }