HttpStatus status = HttpStatus.getStatus(createTokenResponse.getStatusCode());
if (status.isError()) {
if (status.equals(HttpStatus.Unauthorized)) {
throw new AuthorizationException(HttpStatus.Unauthorized.toString());
} else {
throw new CommunicationErrorException(status);
}
}
String newToken = createTokenResponse.getToken();
tokenStore.setToken(newToken);