comparison src/goodjava/lucene/backup/BackupIndexWriter.java @ 1506:d80395468b4e

ssl security in code
author Franklin Schmidt <fschmidt@gmail.com>
date Fri, 15 May 2020 18:29:47 -0600
parents f443542d8650
children 86c5e7000ecf
comparison
equal deleted inserted replaced
1505:01e38174d580 1506:d80395468b4e
9 import java.util.Map; 9 import java.util.Map;
10 import java.util.HashMap; 10 import java.util.HashMap;
11 import java.util.Arrays; 11 import java.util.Arrays;
12 import java.util.concurrent.Executors; 12 import java.util.concurrent.Executors;
13 import java.util.concurrent.ExecutorService; 13 import java.util.concurrent.ExecutorService;
14 import javax.net.ssl.SSLSocketFactory;
15 import javax.net.ssl.SSLSocket; 14 import javax.net.ssl.SSLSocket;
16 import goodjava.io.IoUtils; 15 import goodjava.io.IoUtils;
17 import goodjava.rpc.RpcClient; 16 import goodjava.rpc.RpcClient;
18 import goodjava.rpc.RpcCall; 17 import goodjava.rpc.RpcCall;
19 import goodjava.rpc.RpcResult; 18 import goodjava.rpc.RpcResult;
140 static RpcClient rpcClient(String backupDomain) throws IOException { 139 static RpcClient rpcClient(String backupDomain) throws IOException {
141 Socket socket; 140 Socket socket;
142 if( BackupServer.cipherSuites == null ) { 141 if( BackupServer.cipherSuites == null ) {
143 socket = new Socket(backupDomain,BackupServer.port); 142 socket = new Socket(backupDomain,BackupServer.port);
144 } else { 143 } else {
145 socket = SSLSocketFactory.getDefault().createSocket(backupDomain,BackupServer.port); 144 socket = IoUtils.getSSLSocketFactory().createSocket(backupDomain,BackupServer.port);
146 ((SSLSocket)socket).setEnabledCipherSuites(BackupServer.cipherSuites); 145 ((SSLSocket)socket).setEnabledCipherSuites(BackupServer.cipherSuites);
147 } 146 }
148 return new RpcClient(socket); 147 return new RpcClient(socket);
149 } 148 }
150 } 149 }