private void handleAuthenticationFailure(ClientEndpointImpl endpoint, ClientRequest request) {
Exception exception;
if (nodeEngine.isActive()) {
String message = "Client " + endpoint + " must authenticate before any operation.";
logger.severe(message);
exception = new AuthenticationException(message);
} else {
exception = new HazelcastInstanceNotActiveException();
}
endpoint.sendResponse(exception, request.getCallId());
endpointManager.removeEndpoint(endpoint);