}
private byte[] asBytes(Transaction transaction) throws IOException, JMSException {
if (transaction instanceof XATransactionCommand) {
XATransactionCommand packetTask = (XATransactionCommand) transaction;
return packetTask.toBytes();
}
else {
throw new IOException("Unsupported transaction type: " + transaction);
}
}