private void setDigestAfterReadTest() throws NoSuchAlgorithmException, RestServiceException {
    List<HttpContent> httpContents = new ArrayList<HttpContent>();
    generateContent(httpContents);
    Channel channel = new MockChannel();
    NettyRequest nettyRequest = createNettyRequest(HttpMethod.POST, "/", null, channel);
    ByteBufferAsyncWritableChannel writeChannel = new ByteBufferAsyncWritableChannel();
    ReadIntoCallback callback = new ReadIntoCallback();
    nettyRequest.readInto(writeChannel, callback);

    try {
      nettyRequest.setDigestAlgorithm("MD5");
      fail("Setting a digest algorithm should have failed because readInto() has already been called");
    } catch (IllegalStateException e) {
      // expected. Nothing to do.
    }

    writeChannel.close();
    closeRequestAndValidate(nettyRequest, channel);
  }
Tests for failure when {@link NettyRequest#setDigestAlgorithm(String)} after
{@link NettyRequest#readInto(AsyncWritableChannel, Callback)} is called.
@throws NoSuchAlgorithmException
@throws RestServiceException
ambry-rest/src/test/java/com/github/ambry/rest/NettyRequestTest.java