*
* @param message message to be sent
*/
public void update(AgentUpdateGrinderMessage message) throws CommunicationException {
if (message.getOffset() != offset) {
throw new CommunicationException("Expected " + offset + " offset," +
" but " + message.getOffset() + " was sent. " + ToStringBuilder.reflectionToString(message));
}
try {
IOUtils.write(message.getBinary(), agentOutputStream);
offset = message.getNext();
} catch (IOException e) {
throw new CommunicationException("Error while writing binary", e);
}
if (message.getNext() == 0) {
IOUtils.closeQuietly(agentOutputStream);
decompressDownloadPackage();
// Then just exist to run the agent update process.