diff --git a/aws-android-sdk-appsync/src/main/java/com/amazonaws/mobileconnectors/appsync/AWSAppSyncClient.java b/aws-android-sdk-appsync/src/main/java/com/amazonaws/mobileconnectors/appsync/AWSAppSyncClient.java index 545b9181..b2ad22c5 100644 --- a/aws-android-sdk-appsync/src/main/java/com/amazonaws/mobileconnectors/appsync/AWSAppSyncClient.java +++ b/aws-android-sdk-appsync/src/main/java/com/amazonaws/mobileconnectors/appsync/AWSAppSyncClient.java @@ -82,14 +82,17 @@ private AWSAppSyncClient(AWSAppSyncClient.Builder builder) { throw new RuntimeException("Client requires credentials. Please use #apiKey() #credentialsProvider() or #cognitoUserPoolsAuthProvider() to set the credentials."); } - OkHttpClient okHttpClient = builder.mOkHttpClient; - - if (okHttpClient == null) { - okHttpClient = new OkHttpClient.Builder() - .addInterceptor(appSyncSigV4SignerInterceptor) - .build(); + OkHttpClient.Builder okHttpClientBuilder; + if (builder.mOkHttpClient == null) { + okHttpClientBuilder = new OkHttpClient.Builder(); + } else { + okHttpClientBuilder = builder.mOkHttpClient.newBuilder(); } + OkHttpClient okHttpClient = okHttpClientBuilder + .addInterceptor(appSyncSigV4SignerInterceptor) + .build(); + AppSyncMutationsSqlHelper mutationsSqlHelper = new AppSyncMutationsSqlHelper(builder.mContext, defaultMutationSqlStoreName); AppSyncMutationSqlCacheOperations sqlCacheOperations = new AppSyncMutationSqlCacheOperations(mutationsSqlHelper); mutationMap = new HashMap<>();