Skip to content

Commit c949bdd

Browse files
committed
Adjust logging
1 parent 8a8bacd commit c949bdd

2 files changed

Lines changed: 20 additions & 3 deletions

File tree

src/test/java/org/java_websocket/misc/OpeningHandshakeRejectionTest.java

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -266,12 +266,28 @@ public void onClose(int code, String reason, boolean remote) {
266266

267267
@Override
268268
public void onError(Exception ex) {
269-
fail("There should not be an exception");
269+
fail("There should not be an exception: " + ex.getMessage());
270270
}
271271
};
272-
Thread finalThread = new Thread(webSocketClient);
272+
final AssertionError[] exc = new AssertionError[1];
273+
exc[0] = null;
274+
Thread finalThread = new Thread(new Runnable() {
275+
@Override
276+
public void run() {
277+
try {
278+
webSocketClient.run();
279+
}catch(AssertionError e){
280+
exc[0] = e;
281+
countDownLatch.countDown();
282+
}
283+
}
284+
285+
});
273286
finalThread.start();
274287
finalThread.join();
288+
if (exc[0] != null) {
289+
throw exc[0];
290+
}
275291
countDownLatch.await();
276292
}
277293
}

src/test/java/org/java_websocket/protocols/ProtocolHandshakeRejectionTest.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -615,7 +615,7 @@ public void onClose(int code, String reason, boolean remote) {
615615

616616
@Override
617617
public void onError(Exception ex) {
618-
fail("There should not be an exception");
618+
fail("There should not be an exception: " + ex.getMessage());
619619
}
620620
};
621621
final AssertionError[] exc = new AssertionError[1];
@@ -627,6 +627,7 @@ public void run() {
627627
webSocketClient.run();
628628
}catch(AssertionError e){
629629
exc[0] = e;
630+
countDownLatch.countDown();
630631
}
631632
}
632633

0 commit comments

Comments
 (0)