Skip to content

Commit b7afe5b

Browse files
committed
fix when proxy tunneling failed (IOException is hidden) JDK-8173620
1 parent f3d299f commit b7afe5b

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

src/main/java/org/java_websocket/client/WebSocketClient.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
import java.io.IOException;
2929
import java.io.InputStream;
3030
import java.io.OutputStream;
31+
import java.lang.reflect.InvocationTargetException;
3132
import java.net.InetSocketAddress;
3233
import java.net.Proxy;
3334
import java.net.Socket;
@@ -452,6 +453,15 @@ public void run() {
452453
onWebsocketError( engine, e );
453454
engine.closeConnection( CloseFrame.NEVER_CONNECTED, e.getMessage() );
454455
return;
456+
} catch (InternalError e) {
457+
// https://bugs.openjdk.java.net/browse/JDK-8173620
458+
if (e.getCause() instanceof InvocationTargetException && e.getCause().getCause() instanceof IOException) {
459+
IOException cause = (IOException) e.getCause().getCause();
460+
onWebsocketError(engine, cause);
461+
engine.closeConnection(CloseFrame.NEVER_CONNECTED, cause.getMessage());
462+
return;
463+
}
464+
throw e;
455465
}
456466

457467
writeThread = new Thread( new WebsocketWriteThread(this) );

0 commit comments

Comments
 (0)