try {
final RegistrationResponseV4 regResponse = RegistrationResponseV4.parseFrom(
frameInfo.getPayload());
if (regResponse.getResult() != RegistrationResponseV4.ResultCode.OK) {
LOG.fatal("Registration failed: " + regResponse.getStatusMessage());
throw new RegistrationException("Registration failed");
}
LOG.debug("Received response to resource registration request\n" + regResponse.toString());
if (regResponse.hasServerSuppliedConf()) {
ServerSuppliedConf serverSuppliedConf = regResponse.getServerSuppliedConf();
LOG.info("registration successful. Received config info from the SDC server\n" +
regResponse.getServerSuppliedConf().toString());
healthCheckHandler.setServerSuppliedConf(serverSuppliedConf);
// Support for session-based encryption:
if (serverSuppliedConf.hasKeyAlgo() && serverSuppliedConf.hasKeyBytes()) {
this.sdcKeysManager.storeSessionKey(
serverSuppliedConf.getSessionId(),
serverSuppliedConf.getKeyAlgo(),
serverSuppliedConf.getKeyBytes().toByteArray());
}
}
} catch (InvalidProtocolBufferException e) {
throw new RegistrationException(e);
} catch (AgentConfigurationException e) {
throw new RegistrationException(e);
}
}