1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28 package org.apache.hc.client5.testing.extension.sync;
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.classic.ExecChainHandler;
37 import org.apache.hc.client5.http.io.HttpClientConnectionManager;
38 import org.apache.hc.core5.http.Header;
39 import org.apache.hc.core5.http.HttpRequestInterceptor;
40 import org.apache.hc.core5.http.HttpResponseInterceptor;
41 import org.apache.hc.core5.http.config.Lookup;
42 import org.apache.hc.core5.http.impl.io.HttpRequestExecutor;
43 import org.apache.hc.core5.util.Timeout;
44
45 public interface TestClientBuilder {
46
47 ClientProtocolLevel getProtocolLevel();
48
49 TestClientBuilder setTimeout(Timeout soTimeout);
50
51 TestClientBuilder setConnectionManager(HttpClientConnectionManager connManager);
52
53 default TestClientBuilder addResponseInterceptorFirst(final HttpResponseInterceptor interceptor) {
54 return this;
55 }
56
57 default TestClientBuilder addResponseInterceptorLast(HttpResponseInterceptor interceptor) {
58 throw new UnsupportedOperationException("Operation not supported by " + getProtocolLevel());
59 }
60
61 default TestClientBuilder addRequestInterceptorFirst(HttpRequestInterceptor interceptor) {
62 throw new UnsupportedOperationException("Operation not supported by " + getProtocolLevel());
63 }
64
65 default TestClientBuilder addRequestInterceptorLast(HttpRequestInterceptor interceptor) {
66 throw new UnsupportedOperationException("Operation not supported by " + getProtocolLevel());
67 }
68
69 default TestClientBuilder setUserTokenHandler(UserTokenHandler userTokenHandler) {
70 throw new UnsupportedOperationException("Operation not supported by " + getProtocolLevel());
71 }
72
73 default TestClientBuilder setDefaultHeaders(Collection<? extends Header> defaultHeaders) {
74 throw new UnsupportedOperationException("Operation not supported by " + getProtocolLevel());
75 }
76
77 default TestClientBuilder setRetryStrategy(HttpRequestRetryStrategy retryStrategy) {
78 throw new UnsupportedOperationException("Operation not supported by " + getProtocolLevel());
79 }
80
81 default TestClientBuilder setTargetAuthenticationStrategy(AuthenticationStrategy targetAuthStrategy) {
82 throw new UnsupportedOperationException("Operation not supported by " + getProtocolLevel());
83 }
84
85 default TestClientBuilder setDefaultAuthSchemeRegistry(Lookup<AuthSchemeFactory> authSchemeRegistry) {
86 throw new UnsupportedOperationException("Operation not supported by " + getProtocolLevel());
87 }
88
89 default TestClientBuilder setRequestExecutor(HttpRequestExecutor requestExec) {
90 throw new UnsupportedOperationException("Operation not supported by " + getProtocolLevel());
91 }
92
93 default TestClientBuilder addExecInterceptorFirst(String name, ExecChainHandler interceptor) {
94 throw new UnsupportedOperationException("Operation not supported by " + getProtocolLevel());
95 }
96
97 default TestClientBuilder addExecInterceptorLast(String name, ExecChainHandler interceptor) {
98 throw new UnsupportedOperationException("Operation not supported by " + getProtocolLevel());
99 }
100
101 TestClient build() throws Exception;
102
103 }