20
20
import com .navercorp .pinpoint .grpc .ChannelTypeEnum ;
21
21
import com .navercorp .pinpoint .grpc .ExecutorUtils ;
22
22
import com .navercorp .pinpoint .grpc .client .config .ClientOption ;
23
- import com .navercorp .pinpoint .grpc .security .SslClientConfig ;
24
- import com .navercorp .pinpoint .grpc .security .SslContextFactory ;
25
23
import io .grpc .ClientInterceptor ;
26
24
import io .grpc .ManagedChannel ;
27
25
import io .grpc .Metadata ;
39
37
import org .apache .logging .log4j .LogManager ;
40
38
import org .apache .logging .log4j .Logger ;
41
39
42
- import javax .net .ssl .SSLException ;
43
40
import java .util .ArrayList ;
44
41
import java .util .List ;
45
42
import java .util .Objects ;
@@ -63,7 +60,8 @@ public class DefaultChannelFactory implements ChannelFactory {
63
60
private final HeaderFactory headerFactory ;
64
61
65
62
private final ClientOption clientOption ;
66
- private final SslClientConfig sslClientConfig ;
63
+ // private final SslClientConfig sslClientConfig;
64
+ private final SslContext sslContext ;
67
65
68
66
private final List <ClientInterceptor > clientInterceptorList ;
69
67
private final NameResolverProvider nameResolverProvider ;
@@ -79,15 +77,15 @@ public class DefaultChannelFactory implements ChannelFactory {
79
77
HeaderFactory headerFactory ,
80
78
NameResolverProvider nameResolverProvider ,
81
79
ClientOption clientOption ,
82
- SslClientConfig sslClientConfig ,
83
- List < ClientInterceptor > clientInterceptorList ) {
80
+ List < ClientInterceptor > clientInterceptorList ,
81
+ SslContext sslContext ) {
84
82
this .factoryName = Objects .requireNonNull (factoryName , "factoryName" );
85
83
this .executorQueueSize = executorQueueSize ;
86
84
this .headerFactory = Objects .requireNonNull (headerFactory , "headerFactory" );
87
85
// @Nullable
88
86
this .nameResolverProvider = nameResolverProvider ;
89
87
this .clientOption = Objects .requireNonNull (clientOption , "clientOption" );
90
- this .sslClientConfig = Objects . requireNonNull ( sslClientConfig , "sslClientConfig" ) ;
88
+ this .sslContext = sslContext ;
91
89
92
90
Objects .requireNonNull (clientInterceptorList , "clientInterceptorList" );
93
91
this .clientInterceptorList = new ArrayList <>(clientInterceptorList );
@@ -151,13 +149,7 @@ public ManagedChannel build(String channelName, String host, int port) {
151
149
}
152
150
setupClientOption (channelBuilder );
153
151
154
- if (sslClientConfig .isEnable ()) {
155
- SslContext sslContext = null ;
156
- try {
157
- sslContext = SslContextFactory .create (sslClientConfig );
158
- } catch (SSLException e ) {
159
- throw new SecurityException (e );
160
- }
152
+ if (sslContext != null ) {
161
153
channelBuilder .sslContext (sslContext );
162
154
channelBuilder .negotiationType (NegotiationType .TLS );
163
155
}
0 commit comments