View Javadoc
1   /*
2    * ====================================================================
3    * Licensed to the Apache Software Foundation (ASF) under one
4    * or more contributor license agreements.  See the NOTICE file
5    * distributed with this work for additional information
6    * regarding copyright ownership.  The ASF licenses this file
7    * to you under the Apache License, Version 2.0 (the
8    * "License"); you may not use this file except in compliance
9    * with the License.  You may obtain a copy of the License at
10   *
11   *   http://www.apache.org/licenses/LICENSE-2.0
12   *
13   * Unless required by applicable law or agreed to in writing,
14   * software distributed under the License is distributed on an
15   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16   * KIND, either express or implied.  See the License for the
17   * specific language governing permissions and limitations
18   * under the License.
19   * ====================================================================
20   *
21   * This software consists of voluntary contributions made by many
22   * individuals on behalf of the Apache Software Foundation.  For more
23   * information on the Apache Software Foundation, please see
24   * <http://www.apache.org/>.
25   *
26   */
27  
28  package org.apache.hc.client5.testing.extension.async;
29  
30  import java.util.Collection;
31  
32  import org.apache.hc.client5.http.AuthenticationStrategy;
33  import org.apache.hc.client5.http.HttpRequestRetryStrategy;
34  import org.apache.hc.client5.http.UserTokenHandler;
35  import org.apache.hc.client5.http.auth.AuthSchemeFactory;
36  import org.apache.hc.client5.http.config.TlsConfig;
37  import org.apache.hc.core5.http.Header;
38  import org.apache.hc.core5.http.HttpRequestInterceptor;
39  import org.apache.hc.core5.http.HttpResponseInterceptor;
40  import org.apache.hc.core5.http.config.Http1Config;
41  import org.apache.hc.core5.http.config.Lookup;
42  import org.apache.hc.core5.http.nio.ssl.TlsStrategy;
43  import org.apache.hc.core5.http2.config.H2Config;
44  import org.apache.hc.core5.util.Timeout;
45  
46  public interface TestAsyncClientBuilder {
47  
48      ClientProtocolLevel getProtocolLevel();
49  
50      TestAsyncClientBuilder setTimeout(Timeout soTimeout);
51  
52      default TestAsyncClientBuilder addResponseInterceptorFirst(final HttpResponseInterceptor interceptor) {
53          return this;
54      }
55  
56      default TestAsyncClientBuilder addResponseInterceptorLast(HttpResponseInterceptor interceptor) {
57          throw new UnsupportedOperationException("Operation not supported by " + getProtocolLevel());
58      }
59  
60      default TestAsyncClientBuilder addRequestInterceptorFirst(HttpRequestInterceptor interceptor) {
61          throw new UnsupportedOperationException("Operation not supported by " + getProtocolLevel());
62      }
63  
64      default TestAsyncClientBuilder addRequestInterceptorLast(HttpRequestInterceptor interceptor) {
65          throw new UnsupportedOperationException("Operation not supported by " + getProtocolLevel());
66      }
67  
68      default TestAsyncClientBuilder setTlsStrategy(TlsStrategy tlsStrategy) {
69          throw new UnsupportedOperationException("Operation not supported by " + getProtocolLevel());
70      }
71  
72      default TestAsyncClientBuilder setDefaultTlsConfig(TlsConfig tlsConfig) {
73          throw new UnsupportedOperationException("Operation not supported by " + getProtocolLevel());
74      }
75  
76      default TestAsyncClientBuilder setHttp1Config(Http1Config http1Config) {
77          throw new UnsupportedOperationException("Operation not supported by " + getProtocolLevel());
78      }
79  
80      default TestAsyncClientBuilder setH2Config(H2Config http1Config) {
81          throw new UnsupportedOperationException("Operation not supported by " + getProtocolLevel());
82      }
83  
84      default TestAsyncClientBuilder setUserTokenHandler(UserTokenHandler userTokenHandler) {
85          throw new UnsupportedOperationException("Operation not supported by " + getProtocolLevel());
86      }
87  
88      default TestAsyncClientBuilder setDefaultHeaders(Collection<? extends Header> defaultHeaders) {
89          throw new UnsupportedOperationException("Operation not supported by " + getProtocolLevel());
90      }
91  
92      default TestAsyncClientBuilder setRetryStrategy(HttpRequestRetryStrategy retryStrategy) {
93          throw new UnsupportedOperationException("Operation not supported by " + getProtocolLevel());
94      }
95  
96      default TestAsyncClientBuilder setTargetAuthenticationStrategy(AuthenticationStrategy targetAuthStrategy) {
97          throw new UnsupportedOperationException("Operation not supported by " + getProtocolLevel());
98      }
99  
100     default TestAsyncClientBuilder setDefaultAuthSchemeRegistry(Lookup<AuthSchemeFactory> authSchemeRegistry) {
101         throw new UnsupportedOperationException("Operation not supported by " + getProtocolLevel());
102     }
103 
104     TestAsyncClient build() throws Exception;
105 
106 }