AWS4Signer extends AbstractAWSSigner implements
        ServiceAwareSigner, RegionAwareSigner, Presigner, EndpointPrefixAwareSigner, RegionFromEndpointResolverAwareSigner { @Override public void sign(SignableRequest<?> request, AWSCredentials credentials) { if (isAnonymous(credentials)) { return; } AWSCredentials sanitizedCredentials = sanitizeCredentials(credentials); if (sanitizedCredentials instanceof AWSSessionCredentials) { addSessionCredentials(request, (AWSSessionCredentials) sanitizedCredentials); } final AWS4SignerRequestParams signerParams = new AWS4SignerRequestParams( request, overriddenDate, regionName, serviceName, AWS4_SIGNING_ALGORITHM, endpointPrefix, regionFromEndpointResolver); addHostHeader(request); request.addHeader(X_AMZ_DATE, signerParams.getFormattedSigningDateTime()); String contentSha256 = calculateContentHash(request); if ("required".equals(request.getHeaders().get(X_AMZ_CONTENT_SHA256))) { request.addHeader(X_AMZ_CONTENT_SHA256, contentSha256); } final String canonicalRequest = createCanonicalRequest(request, contentSha256); final String stringToSign = createStringToSign(canonicalRequest, signerParams); final byte[] signingKey = deriveSigningKey(sanitizedCredentials, signerParams); final byte[] signature = computeSignature(stringToSign, signingKey, signerParams); request.addHeader( AUTHORIZATION, buildAuthorizationHeader(request, signature, sanitizedCredentials, signerParams)); processRequestPayload(request, signature, signingKey, signerParams); } AWS4Signer();  AWS4Signer(boolean doubleUrlEncoding); @SdkTestInternalApi  AWS4Signer(SdkClock clock); private  AWS4Signer(boolean doubleUrlEncode, SdkClock clock); @Override void setServiceName(String serviceName); @Override void setRegionName(String regionName); @Override void setEndpointPrefix(String endpointPrefix); @SdkTestInternalApi void setOverrideDate(Date overriddenDate); @Override void setRegionFromEndpointResolver(RegionFromEndpointResolver resolver); String getRegionName(); String getServiceName(); Date getOverriddenDate(); @Override void sign(SignableRequest<?> request, AWSCredentials credentials); @Override void presignRequest(SignableRequest<?> request, AWSCredentials credentials,
            Date userSpecifiedExpirationDate);  }
@Test(expected = IllegalArgumentException.class) public void invalidEndpointResultsInIllegalArgumentException() throws Exception { SignableRequest<?> request = MockRequestBuilder.create() .withContent(new ByteArrayInputStream("{\"TableName\": \"foo\"}".getBytes())) .withHeader("Host", "s3.US_WEST_2.amazonaws.com") .withHeader("x-amz-archive-description", "test test") .withPath("/") .withEndpoint("https: .build(); signer.sign(request, new BasicAWSCredentials("akid", "skid")); }