SSLSocketTemplate.java revision 2362
2362N/A * Copyright (c) 2001, 2005, Oracle and/or its affiliates. All rights reserved. 0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 0N/A * This code is free software; you can redistribute it and/or modify it 0N/A * under the terms of the GNU General Public License version 2 only, as 0N/A * published by the Free Software Foundation. 0N/A * This code is distributed in the hope that it will be useful, but WITHOUT 0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 0N/A * version 2 for more details (a copy is included in the LICENSE file that 0N/A * accompanied this code). 0N/A * You should have received a copy of the GNU General Public License version 0N/A * 2 along with this work; if not, write to the Free Software Foundation, 0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 2362N/A * or visit www.oracle.com if you need additional information or have any 0N/A * @author Brad Wetmore 0N/A * ============================================================= 0N/A * Set the various variables needed for the tests, then 0N/A * specify what tests to run on each side. 0N/A * Should we run the client or server in a separate thread? 0N/A * Both sides can throw exceptions, but do you have a preference 0N/A * as to which side should be the main thread. 0N/A * Where do we find the keystores? 0N/A * Is the server ready to serve? 0N/A * Turn on SSL debugging? 0N/A * If the client or server is doing some kind of object creation 0N/A * that the other side depends on, and that thread prematurely 0N/A * exits, you may experience a hang. The test harness will 0N/A * terminate all hung threads after its timeout has expired, 0N/A * currently 3 minutes by default, but you might try to be 0N/A * smart about it.... 0N/A * Define the server side of the test. 0N/A * If the server prematurely exits, serverReady will be set to true 0N/A * to avoid infinite hangs. 0N/A * Signal Client, we're ready for his connect. 0N/A * Define the client side of the test. 0N/A * If the server prematurely exits, serverReady will be set to true 0N/A * to avoid infinite hangs. 0N/A * Wait for server to get started. 0N/A * ============================================================= 0N/A * The remainder is just support stuff 0N/A // use any free port by default 0N/A * Primary constructor, used to drive remainder of the test. 0N/A * Fork off the other side, then do your work. 0N/A // swallow for now. Show later 0N/A * Wait for other side to close down. 0N/A * When we get here, the test is pretty much over. 0N/A * Which side threw the error? 0N/A * If both failed, return the curthread's exception, but also 0N/A * print the remote side Exception 0N/A * Our server thread just died. 0N/A * Release the client, if not active already... 0N/A * Our client thread just died.