1 /*
2 * Copyright 2010-2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License").
5 * You may not use this file except in compliance with the License.
6 * A copy of the License is located at
7 *
8 * http://aws.amazon.com/apache2.0
9 *
10 * or in the "license" file accompanying this file. This file is distributed
11 * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12 * express or implied. See the License for the specific language governing
13 * permissions and limitations under the License.
14 */
15 package com.amazonaws;
16
17 import com.amazonaws.annotation.NotThreadSafe;
18
19 import org.apache.http.conn.socket.ConnectionSocketFactory;
20
21 /**
22 * Used for Apache HTTP client specific custom configurations.
23 */
24 @NotThreadSafe
25 public final class ApacheHttpClientConfig {
26 private ConnectionSocketFactory sslSocketFactory;
27
28 ApacheHttpClientConfig() {}
29
30 ApacheHttpClientConfig(ApacheHttpClientConfig that) {
31 this.sslSocketFactory = that.sslSocketFactory;
32 }
33
34 /**
35 * Returns a custom Apache HTTP client specific SSL socket factory;
36 * or null if there is none.
37 */
38 public ConnectionSocketFactory getSslSocketFactory() {
39 return sslSocketFactory;
40 }
41
42 /**
43 * Sets a custom Apache HTTP client specific SSL socket factory.
44 *
45 * @param sslSocketFactory a custom Apache HTTP client specific SSL socket
46 * factory; or null if there is none.
47 */
48 public void setSslSocketFactory(ConnectionSocketFactory sslSocketFactory) {
49 this.sslSocketFactory = sslSocketFactory;
50 }
51
52 /**
53 * Fluent API for setting a custom Apache HTTP client specific SSL socket
54 * factory.
55 *
56 * @param sslSocketFactory a custom Apache HTTP client specific SSL socket
57 * factory; or null if there is none.
58 */
59 public ApacheHttpClientConfig withSslSocketFactory(
60 ConnectionSocketFactory sslSocketFactory) {
61 this.sslSocketFactory = sslSocketFactory;
62 return this;
63 }
64 }