### Question:
S3V4Authentication { static String getUnverifiedPayloadHash( final MappingHttpRequest request) throws AccessDeniedException { final String contentShaHeader = request.getHeader(S3V4Authentication.AWS_CONTENT_SHA_HEADER); if ( !Strings.isNullOrEmpty(contentShaHeader) ) { if ( !STREAMING_PAYLOAD.equals(contentShaHeader) && !UNSIGNED_PAYLOAD.equals(contentShaHeader) ) { final byte[] binSha256 = BaseEncoding.base16( ).lowerCase( ).decode( contentShaHeader ); if ( binSha256.length != 32 ) { throw new AccessDeniedException(null, "x-amz-content-sha256 header is invalid."); } } } else { throw new AccessDeniedException( null, "x-amz-content-sha256 header is missing." ); } return contentShaHeader; } private  S3V4Authentication();  static final String AWS_V4_AUTH_TYPE; static final String AWS_CONTENT_SHA_HEADER; static final String AWS_EXPIRES_PARAM; static final String AWS_DECODED_CONTENT_LEN; static final String STREAMING_PAYLOAD; static final String UNSIGNED_PAYLOAD; }### Answer:
@Test public void testBuildAndVerifyPayloadHash() throws Throwable { MappingHttpRequest request = new MappingHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.PUT, "/test$file.text"); request.addHeader("x-amz-content-sha256", "UNSIGNED-PAYLOAD"); String result = S3V4Authentication.getUnverifiedPayloadHash(request); assertEquals("UNSIGNED-PAYLOAD", result); request = new MappingHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.PUT, "/test$file.text"); request.addHeader("x-amz-content-sha256", "44ce7dd67c959e0d3524ffac1771dfbba87d2b6b4b4e99e42034a8b803f8b072"); request.setContent(ChannelBuffers.copiedBuffer("Welcome to Amazon S3.", Charset.defaultCharset())); result = S3V4Authentication.getUnverifiedPayloadHash(request); assertEquals("44ce7dd67c959e0d3524ffac1771dfbba87d2b6b4b4e99e42034a8b803f8b072", result); request = new MappingHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.PUT, "/test$file.text"); request.addHeader("x-amz-content-sha256", "STREAMING-AWS4-HMAC-SHA256-PAYLOAD"); result = S3V4Authentication.getUnverifiedPayloadHash(request); assertEquals("STREAMING-AWS4-HMAC-SHA256-PAYLOAD", result); }