Making error message on Session.getRemote() more clear about connection state
This commit is contained in:
parent
6d75e18661
commit
f092eeb94c
|
@ -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