Search in sources :

Example 6 with RequestHandler2

use of com.amazonaws.handlers.RequestHandler2 in project aws-sdk-android by aws-amplify.

the class AmazonWebServiceClientTest method testAddAndRemoveRequestHandler2.

@Test
public void testAddAndRemoveRequestHandler2() {
    final RequestHandler2 rh = new RequestHandler2() {

        @Override
        public void beforeRequest(Request<?> request) {
        }

        @Override
        public void afterResponse(Request<?> request, Response<?> response) {
        }

        @Override
        public void afterError(Request<?> request, Response<?> response, Exception e) {
        }
    };
    final AmazonTestClient client = new AmazonTestClient();
    client.addRequestHandler(rh);
    assertEquals(client.requestHandler2s.size(), 1);
    assertSame(client.requestHandler2s.get(0), rh);
    client.removeRequestHandler(rh);
    assertEquals(client.requestHandler2s.size(), 0);
}
Also used : RequestHandler2(com.amazonaws.handlers.RequestHandler2) URISyntaxException(java.net.URISyntaxException) Test(org.junit.Test)

Aggregations

RequestHandler2 (com.amazonaws.handlers.RequestHandler2)6 URISyntaxException (java.net.URISyntaxException)5 AmazonClientException (com.amazonaws.AmazonClientException)4 Test (org.junit.Test)4 AmazonServiceException (com.amazonaws.AmazonServiceException)3 AmazonWebServiceRequest (com.amazonaws.AmazonWebServiceRequest)3 AmazonWebServiceResponse (com.amazonaws.AmazonWebServiceResponse)3 DefaultRequest (com.amazonaws.DefaultRequest)3 Request (com.amazonaws.Request)3 Response (com.amazonaws.Response)3 CRC32MismatchException (com.amazonaws.internal.CRC32MismatchException)3 IOException (java.io.IOException)3 ArrayList (java.util.ArrayList)3 DefaultAWSCredentialsProviderChain (com.amazonaws.auth.DefaultAWSCredentialsProviderChain)1 CredentialsRequestHandler (com.amazonaws.handlers.CredentialsRequestHandler)1 AmazonDynamoDBClient (com.amazonaws.services.dynamodbv2.AmazonDynamoDBClient)1 AWSRequestMetrics (com.amazonaws.util.AWSRequestMetrics)1 TimingInfo (com.amazonaws.util.TimingInfo)1 URI (java.net.URI)1