@@ -97,8 +97,8 @@ public void write(SSLSocket sock, byte[] data) throws Exception {
9797 private static KeyManager [] getKeyManager (boolean empty ) throws Exception {
9898 FileInputStream fis = null ;
9999 if (!empty ) {
100- fis = new FileInputStream (System .getProperty ("test.src" , "./" ) + "/" + pathToStores +
101- "/" + keyStoreFile );
100+ fis = new FileInputStream (System .getProperty ("test.src" , "./" ) +
101+ "/" + pathToStores + "/" + keyStoreFile );
102102 }
103103 // Load the keystore
104104 char [] pwd = passwd .toCharArray ();
@@ -113,8 +113,8 @@ private static KeyManager[] getKeyManager(boolean empty) throws Exception {
113113 private static TrustManager [] getTrustManager (boolean empty ) throws Exception {
114114 FileInputStream fis = null ;
115115 if (!empty ) {
116- fis = new FileInputStream (System .getProperty ("test.src" , "./" ) + "/" + pathToStores +
117- "/" + trustStoreFile );
116+ fis = new FileInputStream (System .getProperty ("test.src" , "./" ) +
117+ "/" + pathToStores + "/" + trustStoreFile );
118118 }
119119 // Load the keystore
120120 KeyStore ks = KeyStore .getInstance (KeyStore .getDefaultType ());
@@ -148,7 +148,6 @@ static class Server extends TLSBase {
148148 // Clients sockets are kept in a hash table with the port as the key.
149149 ConcurrentHashMap <Integer , SSLSocket > clientMap =
150150 new ConcurrentHashMap <>();
151- boolean exit = false ;
152151 Thread t ;
153152 List <Exception > exceptionList = new ArrayList <>();
154153
@@ -157,13 +156,14 @@ static class Server extends TLSBase {
157156 name = "server" ;
158157 try {
159158 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 );
161161 fac = sslContext .getServerSocketFactory ();
162162 ssock = (SSLServerSocket ) fac .createServerSocket (0 );
163163 ssock .setNeedClientAuth (builder .clientauth );
164164 serverPort = ssock .getLocalPort ();
165165 } catch (Exception e ) {
166- System .err .println (e . getMessage () );
166+ System .err .println ("Failure during server initialization" );
167167 e .printStackTrace ();
168168 }
169169
@@ -178,6 +178,7 @@ static class Server extends TLSBase {
178178 try {
179179 write (c , read (c ));
180180 } catch (Exception e ) {
181+ System .out .println ("Caught " + e .getMessage ());
181182 e .printStackTrace ();
182183 exceptionList .add (e );
183184 }
@@ -203,13 +204,14 @@ static class Server extends TLSBase {
203204 name = "server" ;
204205 try {
205206 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 );
207209 fac = sslContext .getServerSocketFactory ();
208210 ssock = (SSLServerSocket ) fac .createServerSocket (0 );
209211 ssock .setNeedClientAuth (true );
210212 serverPort = ssock .getLocalPort ();
211213 } catch (Exception e ) {
212- System .err .println (e . getMessage () );
214+ System .err .println ("Failure during server initialization" );
213215 e .printStackTrace ();
214216 }
215217
@@ -224,7 +226,9 @@ static class Server extends TLSBase {
224226 try {
225227 write (c , read (c ));
226228 } catch (Exception e ) {
229+ System .out .println ("Caught " + e .getMessage ());
227230 e .printStackTrace ();
231+ exceptionList .add (e );
228232 }
229233 }
230234 } catch (Exception ex ) {
@@ -239,7 +243,7 @@ static class Server extends TLSBase {
239243 // test or the test will never end.
240244 void done () {
241245 try {
242- t .interrupt ( );
246+ t .join ( 5000 );
243247 ssock .close ();
244248 } catch (Exception e ) {
245249 System .err .println (e .getMessage ());
0 commit comments