@@ -97,8 +97,8 @@ public void write(SSLSocket sock, byte[] data) throws Exception {
97
97
private static KeyManager [] getKeyManager (boolean empty ) throws Exception {
98
98
FileInputStream fis = null ;
99
99
if (!empty ) {
100
- fis = new FileInputStream (System .getProperty ("test.src" , "./" ) + "/" + pathToStores +
101
- "/" + keyStoreFile );
100
+ fis = new FileInputStream (System .getProperty ("test.src" , "./" ) +
101
+ "/" + pathToStores + "/" + keyStoreFile );
102
102
}
103
103
// Load the keystore
104
104
char [] pwd = passwd .toCharArray ();
@@ -113,8 +113,8 @@ private static KeyManager[] getKeyManager(boolean empty) throws Exception {
113
113
private static TrustManager [] getTrustManager (boolean empty ) throws Exception {
114
114
FileInputStream fis = null ;
115
115
if (!empty ) {
116
- fis = new FileInputStream (System .getProperty ("test.src" , "./" ) + "/" + pathToStores +
117
- "/" + trustStoreFile );
116
+ fis = new FileInputStream (System .getProperty ("test.src" , "./" ) +
117
+ "/" + pathToStores + "/" + trustStoreFile );
118
118
}
119
119
// Load the keystore
120
120
KeyStore ks = KeyStore .getInstance (KeyStore .getDefaultType ());
@@ -148,7 +148,6 @@ static class Server extends TLSBase {
148
148
// Clients sockets are kept in a hash table with the port as the key.
149
149
ConcurrentHashMap <Integer , SSLSocket > clientMap =
150
150
new ConcurrentHashMap <>();
151
- boolean exit = false ;
152
151
Thread t ;
153
152
List <Exception > exceptionList = new ArrayList <>();
154
153
@@ -157,13 +156,14 @@ static class Server extends TLSBase {
157
156
name = "server" ;
158
157
try {
159
158
sslContext = SSLContext .getInstance ("TLS" );
160
- sslContext .init (TLSBase .getKeyManager (builder .km ), TLSBase .getTrustManager (builder .tm ), null );
159
+ sslContext .init (TLSBase .getKeyManager (builder .km ),
160
+ TLSBase .getTrustManager (builder .tm ), null );
161
161
fac = sslContext .getServerSocketFactory ();
162
162
ssock = (SSLServerSocket ) fac .createServerSocket (0 );
163
163
ssock .setNeedClientAuth (builder .clientauth );
164
164
serverPort = ssock .getLocalPort ();
165
165
} catch (Exception e ) {
166
- System .err .println (e . getMessage () );
166
+ System .err .println ("Failure during server initialization" );
167
167
e .printStackTrace ();
168
168
}
169
169
@@ -178,6 +178,7 @@ static class Server extends TLSBase {
178
178
try {
179
179
write (c , read (c ));
180
180
} catch (Exception e ) {
181
+ System .out .println ("Caught " + e .getMessage ());
181
182
e .printStackTrace ();
182
183
exceptionList .add (e );
183
184
}
@@ -203,13 +204,14 @@ static class Server extends TLSBase {
203
204
name = "server" ;
204
205
try {
205
206
sslContext = SSLContext .getInstance ("TLS" );
206
- sslContext .init (TLSBase .getKeyManager (km ), TLSBase .getTrustManager (tm ), null );
207
+ sslContext .init (TLSBase .getKeyManager (km ),
208
+ TLSBase .getTrustManager (tm ), null );
207
209
fac = sslContext .getServerSocketFactory ();
208
210
ssock = (SSLServerSocket ) fac .createServerSocket (0 );
209
211
ssock .setNeedClientAuth (true );
210
212
serverPort = ssock .getLocalPort ();
211
213
} catch (Exception e ) {
212
- System .err .println (e . getMessage () );
214
+ System .err .println ("Failure during server initialization" );
213
215
e .printStackTrace ();
214
216
}
215
217
@@ -224,7 +226,9 @@ static class Server extends TLSBase {
224
226
try {
225
227
write (c , read (c ));
226
228
} catch (Exception e ) {
229
+ System .out .println ("Caught " + e .getMessage ());
227
230
e .printStackTrace ();
231
+ exceptionList .add (e );
228
232
}
229
233
}
230
234
} catch (Exception ex ) {
@@ -239,7 +243,7 @@ static class Server extends TLSBase {
239
243
// test or the test will never end.
240
244
void done () {
241
245
try {
242
- t .interrupt ( );
246
+ t .join ( 5000 );
243
247
ssock .close ();
244
248
} catch (Exception e ) {
245
249
System .err .println (e .getMessage ());
0 commit comments