Mercurial > stress-tester
changeset 1046:0aaa00594dc5
SocketConnection - SSL connection
author | Devel 2 |
---|---|
date | Tue, 14 Apr 2020 15:30:20 +0200 |
parents | f21d268bf590 |
children | 701a034a0fe0 |
files | stress-tester/src/main/java/com/passus/st/emitter/socket/SocketConnection.java |
diffstat | 1 files changed, 7 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/stress-tester/src/main/java/com/passus/st/emitter/socket/SocketConnection.java Tue Apr 14 15:29:56 2020 +0200 +++ b/stress-tester/src/main/java/com/passus/st/emitter/socket/SocketConnection.java Tue Apr 14 15:30:20 2020 +0200 @@ -71,7 +71,13 @@ try { SocketAddress bindAddress = connParams.getBindAddress(); - socket = new Socket(); + if (connParams.isSsl()) { + SSLSocketFactory factory = (SSLSocketFactory) SSLSocketFactory.getDefault(); + socket = factory.createSocket(); + } else { + socket = new Socket(); + } + if (bindAddress != null && ANY_SOCKET.equals(bindAddress)) { socket.bind(socketAddressToJdkSocket(bindAddress)); }