private void ThrowIfNotConnected()
{
if ((InternalState)_state == InternalState.Disposed)
{
throw new ObjectDisposedException(GetType().FullName);
}
else if ((InternalState)_state != InternalState.Connected)
{
throw new InvalidOperationException(SR.net_WebSockets_NotConnected);
}
}
}