String randomChannelName = NotificationListenerTest.class.getName() + new Random().nextInt();
final AtomicInteger messagesReceivedBy1 = new AtomicInteger(0);
final AtomicInteger messagesReceivedBy2 = new AtomicInteger(0);
final NotificationListener notificationListener1 = new NotificationListener("notify.syncany.org", 8080, new NotificationListenerListener() {
@Override
public void pushNotificationReceived(String channel, String message) {
logger.log(Level.INFO, "Client 1: pushNotificationReceived(channel = "+channel+", message = "+message+")");
messagesReceivedBy1.addAndGet(1);
}
});
final NotificationListener notificationListener2 = new NotificationListener("notify.syncany.org", 8080, new NotificationListenerListener() {
@Override
public void pushNotificationReceived(String channel, String message) {
logger.log(Level.INFO, "Client 2: pushNotificationReceived(channel = "+channel+", message = "+message+")");
messagesReceivedBy2.addAndGet(1);
}