|
59 | 59 | import io.netty.buffer.ByteBuf;
|
60 | 60 | import io.netty.buffer.ByteBufAllocator;
|
61 | 61 | import io.netty.buffer.ByteBufOutputStream;
|
62 |
| -import io.netty.channel.Channel; |
63 |
| -import io.netty.channel.ChannelFuture; |
64 |
| -import io.netty.channel.ChannelHandlerContext; |
65 |
| -import io.netty.channel.ChannelInboundHandlerAdapter; |
66 |
| -import io.netty.channel.ChannelInitializer; |
67 |
| -import io.netty.channel.ChannelOption; |
68 |
| -import io.netty.channel.ChannelOutboundHandlerAdapter; |
69 |
| -import io.netty.channel.ChannelPromise; |
70 |
| -import io.netty.channel.ConnectTimeoutException; |
71 |
| -import io.netty.channel.EventLoopGroup; |
72 |
| -import io.netty.channel.nio.NioEventLoopGroup; |
| 62 | +import io.netty.channel.*; |
73 | 63 | import io.netty.channel.socket.SocketChannel;
|
74 | 64 | import io.netty.channel.socket.nio.NioSocketChannel;
|
75 | 65 | import io.netty.handler.codec.DecoderException;
|
|
106 | 96 | import java.util.function.Consumer;
|
107 | 97 | import java.util.function.Supplier;
|
108 | 98 | import java.util.function.ToLongFunction;
|
109 |
| -import javax.net.ssl.SSLEngine; |
110 | 99 | import javax.net.ssl.SSLHandshakeException;
|
111 |
| -import javax.net.ssl.SSLParameters; |
112 | 100 | import org.slf4j.Logger;
|
113 | 101 | import org.slf4j.LoggerFactory;
|
114 | 102 |
|
@@ -248,7 +236,7 @@ public Client(ClientParameters parameters) {
|
248 | 236 | if (b.config().group() == null) {
|
249 | 237 | EventLoopGroup eventLoopGroup;
|
250 | 238 | if (parameters.eventLoopGroup == null) {
|
251 |
| - this.eventLoopGroup = new NioEventLoopGroup(); |
| 239 | + this.eventLoopGroup = Utils.eventLoopGroup(); |
252 | 240 | eventLoopGroup = this.eventLoopGroup;
|
253 | 241 | } else {
|
254 | 242 | this.eventLoopGroup = null;
|
@@ -293,13 +281,6 @@ public void initChannel(SocketChannel ch) {
|
293 | 281 | SslHandler sslHandler =
|
294 | 282 | parameters.sslContext.newHandler(ch.alloc(), parameters.host, parameters.port);
|
295 | 283 |
|
296 |
| - if (parameters.tlsHostnameVerification) { |
297 |
| - SSLEngine sslEngine = sslHandler.engine(); |
298 |
| - SSLParameters sslParameters = sslEngine.getSSLParameters(); |
299 |
| - sslParameters.setEndpointIdentificationAlgorithm("HTTPS"); |
300 |
| - sslEngine.setSSLParameters(sslParameters); |
301 |
| - } |
302 |
| - |
303 | 284 | ch.pipeline().addFirst("ssl", sslHandler);
|
304 | 285 | }
|
305 | 286 | channelCustomizer.accept(ch);
|
@@ -2407,7 +2388,6 @@ public static class ClientParameters {
|
2407 | 2388 | private ChunkChecksum chunkChecksum = JdkChunkChecksum.CRC32_SINGLETON;
|
2408 | 2389 | private MetricsCollector metricsCollector = NoOpMetricsCollector.SINGLETON;
|
2409 | 2390 | private SslContext sslContext;
|
2410 |
| - private boolean tlsHostnameVerification = true; |
2411 | 2391 | private ByteBufAllocator byteBufAllocator;
|
2412 | 2392 | private Duration rpcTimeout;
|
2413 | 2393 | private Consumer<Channel> channelCustomizer = noOpConsumer();
|
@@ -2564,11 +2544,6 @@ public ClientParameters sslContext(SslContext sslContext) {
|
2564 | 2544 | return this;
|
2565 | 2545 | }
|
2566 | 2546 |
|
2567 |
| - public ClientParameters tlsHostnameVerification(boolean tlsHostnameVerification) { |
2568 |
| - this.tlsHostnameVerification = tlsHostnameVerification; |
2569 |
| - return this; |
2570 |
| - } |
2571 |
| - |
2572 | 2547 | public ClientParameters compressionCodecFactory(
|
2573 | 2548 | CompressionCodecFactory compressionCodecFactory) {
|
2574 | 2549 | this.compressionCodecFactory = compressionCodecFactory;
|
|
0 commit comments