setDaemon(true);
}
public void run() {
RedisConnection con = connectionFactory.getConnection();
try {
Thread.sleep(100);
} catch (InterruptedException e) {
e.printStackTrace();
}
con.publish(expectedChannel.getBytes(), expectedMessage.getBytes());
try {
Thread.sleep(100);
} catch (InterruptedException e) {
e.printStackTrace();
}
/*
In some clients, unsubscribe happens async of message
receipt, so not all
messages may be received if unsubscribing now.
Connection.close in teardown
will take care of unsubscribing.
*/
if (!(ConnectionUtils.isAsync(connectionFactory))) {
connection.getSubscription().unsubscribe();
}
con.close();
}
};
t.start();
connection.subscribe(listener, expectedChannel.getBytes());