Making error message on Session.getRemote() more clear about connection state
This commit is contained in:
parent
e23bfc82bb
commit
d553f9f907
|
@ -245,11 +245,14 @@ public class WebSocketSession extends ContainerLifeCycle implements Session, Inc
|
|||
@Override
|
||||
public RemoteEndpoint getRemote()
|
||||
{
|
||||
if (!isOpen())
|
||||
ConnectionState state = connection.getIOState().getConnectionState();
|
||||
|
||||
if ((state == ConnectionState.OPEN) || (state == ConnectionState.CONNECTED))
|
||||
{
|
||||
throw new WebSocketException("Session has not been opened yet");
|
||||
return remote;
|
||||
}
|
||||
return remote;
|
||||
|
||||
throw new WebSocketException("RemoteEndpoint unavailable, current state [" + state + "], expecting [OPEN or CONNECTED]");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in New Issue