diff --git a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/WebSocketSession.java b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/WebSocketSession.java index 90645265950..3654c59c757 100644 --- a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/WebSocketSession.java +++ b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/WebSocketSession.java @@ -242,14 +242,12 @@ public class WebSocketSession extends ContainerLifeCycle implements Session, Inc @Override public RemoteEndpoint getRemote() { - ConnectionState state = connection.getIOState().getConnectionState(); - - if ((state == ConnectionState.OPEN) || (state == ConnectionState.CONNECTED)) + if (connection.getIOState().isOutputAvailable()) { return remote; } - throw new WebSocketException("RemoteEndpoint unavailable, current state [" + state + "], expecting [OPEN or CONNECTED]"); + throw new WebSocketException("RemoteEndpoint unavailable, outgoing connection not open"); } @Override