equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. |
7 * published by the Free Software Foundation. |
187 protected boolean isCustomizedClientConnection() { |
187 protected boolean isCustomizedClientConnection() { |
188 return false; |
188 return false; |
189 } |
189 } |
190 |
190 |
191 /* |
191 /* |
|
192 * Configure the client side socket. |
|
193 */ |
|
194 protected void configureClientSocket(SSLSocket socket) { |
|
195 } |
|
196 |
|
197 /* |
192 * Configure the server side socket. |
198 * Configure the server side socket. |
193 */ |
199 */ |
194 protected void configureServerSocket(SSLServerSocket socket) { |
200 protected void configureServerSocket(SSLServerSocket socket) { |
195 |
|
196 } |
201 } |
197 |
202 |
198 /* |
203 /* |
199 * ============================================= |
204 * ============================================= |
200 * Define the client and server side operations. |
205 * Define the client and server side operations. |
315 SSLContext context = createClientSSLContext(); |
320 SSLContext context = createClientSSLContext(); |
316 SSLSocketFactory sslsf = context.getSocketFactory(); |
321 SSLSocketFactory sslsf = context.getSocketFactory(); |
317 |
322 |
318 try (SSLSocket sslSocket = (SSLSocket)sslsf.createSocket()) { |
323 try (SSLSocket sslSocket = (SSLSocket)sslsf.createSocket()) { |
319 try { |
324 try { |
|
325 configureClientSocket(sslSocket); |
320 sslSocket.connect( |
326 sslSocket.connect( |
321 new InetSocketAddress("localhost", serverPort), 15000); |
327 new InetSocketAddress("localhost", serverPort), 15000); |
322 } catch (IOException ioe) { |
328 } catch (IOException ioe) { |
323 // The server side may be impacted by naughty test cases or |
329 // The server side may be impacted by naughty test cases or |
324 // third party routines, and cannot accept connections. |
330 // third party routines, and cannot accept connections. |