29
29
import org .opensearch .http .HttpTransportSettings ;
30
30
import org .opensearch .http .NullDispatcher ;
31
31
import org .opensearch .http .netty4 .Netty4HttpClient ;
32
- import org .opensearch .plugins .SecureTransportSettingsProvider ;
32
+ import org .opensearch .plugins .SecureHttpTransportSettingsProvider ;
33
+ import org .opensearch .plugins .TransportExceptionHandler ;
33
34
import org .opensearch .rest .BytesRestResponse ;
34
35
import org .opensearch .rest .RestChannel ;
35
36
import org .opensearch .rest .RestRequest ;
40
41
import org .opensearch .threadpool .ThreadPool ;
41
42
import org .opensearch .transport .NettyAllocator ;
42
43
import org .opensearch .transport .SharedGroupFactory ;
43
- import org .opensearch .transport .TcpTransport ;
44
44
import org .opensearch .transport .netty4 .ssl .TrustAllManager ;
45
45
import org .junit .After ;
46
46
import org .junit .Before ;
83
83
import io .netty .handler .codec .http .HttpResponseStatus ;
84
84
import io .netty .handler .codec .http .HttpUtil ;
85
85
import io .netty .handler .codec .http .HttpVersion ;
86
- import io .netty .handler .ssl .ClientAuth ;
87
86
import io .netty .handler .ssl .SslContextBuilder ;
88
87
89
88
import static org .opensearch .core .rest .RestStatus .BAD_REQUEST ;
@@ -104,7 +103,7 @@ public class SecureNetty4HttpServerTransportTests extends OpenSearchTestCase {
104
103
private ThreadPool threadPool ;
105
104
private MockBigArrays bigArrays ;
106
105
private ClusterSettings clusterSettings ;
107
- private SecureTransportSettingsProvider secureTransportSettingsProvider ;
106
+ private SecureHttpTransportSettingsProvider secureHttpTransportSettingsProvider ;
108
107
109
108
@ Before
110
109
public void setup () throws Exception {
@@ -113,14 +112,9 @@ public void setup() throws Exception {
113
112
bigArrays = new MockBigArrays (new MockPageCacheRecycler (Settings .EMPTY ), new NoneCircuitBreakerService ());
114
113
clusterSettings = new ClusterSettings (Settings .EMPTY , ClusterSettings .BUILT_IN_CLUSTER_SETTINGS );
115
114
116
- secureTransportSettingsProvider = new SecureTransportSettingsProvider () {
115
+ secureHttpTransportSettingsProvider = new SecureHttpTransportSettingsProvider () {
117
116
@ Override
118
- public Optional <ServerExceptionHandler > buildHttpServerExceptionHandler (Settings settings , HttpServerTransport transport ) {
119
- return Optional .empty ();
120
- }
121
-
122
- @ Override
123
- public Optional <ServerExceptionHandler > buildServerTransportExceptionHandler (Settings settings , TcpTransport transport ) {
117
+ public Optional <TransportExceptionHandler > buildHttpServerExceptionHandler (Settings settings , HttpServerTransport transport ) {
124
118
return Optional .empty ();
125
119
}
126
120
@@ -146,22 +140,6 @@ public Optional<SSLEngine> buildSecureHttpServerEngine(Settings settings, HttpSe
146
140
throw new SSLException (ex );
147
141
}
148
142
}
149
-
150
- @ Override
151
- public Optional <SSLEngine > buildSecureServerTransportEngine (Settings settings , TcpTransport transport ) throws SSLException {
152
- return Optional .empty ();
153
- }
154
-
155
- @ Override
156
- public Optional <SSLEngine > buildSecureClientTransportEngine (Settings settings , String hostname , int port ) throws SSLException {
157
- return Optional .of (
158
- SslContextBuilder .forClient ()
159
- .clientAuth (ClientAuth .NONE )
160
- .trustManager (TrustAllManager .INSTANCE )
161
- .build ()
162
- .newEngine (NettyAllocator .getAllocator ())
163
- );
164
- }
165
143
};
166
144
}
167
145
@@ -241,7 +219,7 @@ public void dispatchBadRequest(RestChannel channel, ThreadContext threadContext,
241
219
dispatcher ,
242
220
clusterSettings ,
243
221
new SharedGroupFactory (settings ),
244
- secureTransportSettingsProvider ,
222
+ secureHttpTransportSettingsProvider ,
245
223
NoopTracer .INSTANCE
246
224
)
247
225
) {
@@ -292,7 +270,7 @@ public void testBindUnavailableAddress() {
292
270
new NullDispatcher (),
293
271
clusterSettings ,
294
272
new SharedGroupFactory (Settings .EMPTY ),
295
- secureTransportSettingsProvider ,
273
+ secureHttpTransportSettingsProvider ,
296
274
NoopTracer .INSTANCE
297
275
)
298
276
) {
@@ -312,7 +290,7 @@ public void testBindUnavailableAddress() {
312
290
new NullDispatcher (),
313
291
clusterSettings ,
314
292
new SharedGroupFactory (settings ),
315
- secureTransportSettingsProvider ,
293
+ secureHttpTransportSettingsProvider ,
316
294
NoopTracer .INSTANCE
317
295
)
318
296
) {
@@ -366,7 +344,7 @@ public void dispatchBadRequest(final RestChannel channel, final ThreadContext th
366
344
dispatcher ,
367
345
clusterSettings ,
368
346
new SharedGroupFactory (settings ),
369
- secureTransportSettingsProvider ,
347
+ secureHttpTransportSettingsProvider ,
370
348
NoopTracer .INSTANCE
371
349
)
372
350
) {
@@ -430,7 +408,7 @@ public void dispatchBadRequest(final RestChannel channel, final ThreadContext th
430
408
dispatcher ,
431
409
clusterSettings ,
432
410
new SharedGroupFactory (Settings .EMPTY ),
433
- secureTransportSettingsProvider ,
411
+ secureHttpTransportSettingsProvider ,
434
412
NoopTracer .INSTANCE
435
413
)
436
414
) {
@@ -487,7 +465,7 @@ public void dispatchBadRequest(final RestChannel channel, final ThreadContext th
487
465
dispatcher ,
488
466
new ClusterSettings (Settings .EMPTY , ClusterSettings .BUILT_IN_CLUSTER_SETTINGS ),
489
467
new SharedGroupFactory (settings ),
490
- secureTransportSettingsProvider ,
468
+ secureHttpTransportSettingsProvider ,
491
469
NoopTracer .INSTANCE
492
470
)
493
471
) {
@@ -562,7 +540,7 @@ public void dispatchBadRequest(final RestChannel channel, final ThreadContext th
562
540
dispatcher ,
563
541
new ClusterSettings (Settings .EMPTY , ClusterSettings .BUILT_IN_CLUSTER_SETTINGS ),
564
542
new SharedGroupFactory (settings ),
565
- secureTransportSettingsProvider ,
543
+ secureHttpTransportSettingsProvider ,
566
544
NoopTracer .INSTANCE
567
545
)
568
546
) {
0 commit comments