This is an automated email from the ASF dual-hosted git repository.
earthchen pushed a commit to branch 3.2
in repository https://gitbox.apache.org/repos/asf/dubbo.git
The following commit(s) were added to refs/heads/3.2 by this push:
new 717053e4cb Init SslContext when channel inited (#15664)
717053e4cb is described below
commit 717053e4cb8d6d7575cf5d35019c3ba04126ad6b
Author: Albumen Kevin <[email protected]>
AuthorDate: Fri Sep 5 20:29:08 2025 +0800
Init SslContext when channel inited (#15664)
---
.../java/org/apache/dubbo/remoting/transport/netty4/NettyClient.java | 2 +-
.../apache/dubbo/remoting/transport/netty4/NettyConnectionClient.java | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git
a/dubbo-remoting/dubbo-remoting-netty4/src/main/java/org/apache/dubbo/remoting/transport/netty4/NettyClient.java
b/dubbo-remoting/dubbo-remoting-netty4/src/main/java/org/apache/dubbo/remoting/transport/netty4/NettyClient.java
index d01a481049..c7bbd16175 100644
---
a/dubbo-remoting/dubbo-remoting-netty4/src/main/java/org/apache/dubbo/remoting/transport/netty4/NettyClient.java
+++
b/dubbo-remoting/dubbo-remoting-netty4/src/main/java/org/apache/dubbo/remoting/transport/netty4/NettyClient.java
@@ -122,13 +122,13 @@ public class NettyClient extends AbstractClient {
.channel(socketChannelClass());
bootstrap.option(ChannelOption.CONNECT_TIMEOUT_MILLIS,
Math.max(DEFAULT_CONNECT_TIMEOUT, getConnectTimeout()));
- SslContext sslContext = SslContexts.buildClientSslContext(getUrl());
bootstrap.handler(new ChannelInitializer<SocketChannel>() {
@Override
protected void initChannel(SocketChannel ch) throws Exception {
int heartbeatInterval = UrlUtils.getHeartbeat(getUrl());
+ SslContext sslContext =
SslContexts.buildClientSslContext(getUrl());
if (sslContext != null) {
ch.pipeline().addLast("negotiation", new
SslClientTlsHandler(sslContext));
}
diff --git
a/dubbo-remoting/dubbo-remoting-netty4/src/main/java/org/apache/dubbo/remoting/transport/netty4/NettyConnectionClient.java
b/dubbo-remoting/dubbo-remoting-netty4/src/main/java/org/apache/dubbo/remoting/transport/netty4/NettyConnectionClient.java
index 5f1c9bd062..81bad70c0b 100644
---
a/dubbo-remoting/dubbo-remoting-netty4/src/main/java/org/apache/dubbo/remoting/transport/netty4/NettyConnectionClient.java
+++
b/dubbo-remoting/dubbo-remoting-netty4/src/main/java/org/apache/dubbo/remoting/transport/netty4/NettyConnectionClient.java
@@ -113,7 +113,6 @@ public class NettyConnectionClient extends
AbstractConnectionClient {
final NettyConnectionHandler connectionHandler = new
NettyConnectionHandler(this);
nettyBootstrap.option(ChannelOption.CONNECT_TIMEOUT_MILLIS,
getConnectTimeout());
- SslContext sslContext = SslContexts.buildClientSslContext(getUrl());
nettyBootstrap.handler(new ChannelInitializer<SocketChannel>() {
@Override
protected void initChannel(SocketChannel ch) {
@@ -121,6 +120,7 @@ public class NettyConnectionClient extends
AbstractConnectionClient {
final ChannelPipeline pipeline = ch.pipeline();
NettySslContextOperator nettySslContextOperator = new
NettySslContextOperator();
+ SslContext sslContext =
SslContexts.buildClientSslContext(getUrl());
if (sslContext != null) {
pipeline.addLast("negotiation", new
SslClientTlsHandler(sslContext));
}