}
@Test(expected = JedisConnectionException.class)
public void handleClientOutputBufferLimitForSubscribeTooSlow()
throws InterruptedException {
final Jedis j = createJedis();
final AtomicBoolean exit = new AtomicBoolean(false);
final Thread t = new Thread(new Runnable() {
public void run() {
try {
// we already set jedis1 config to
// client-output-buffer-limit pubsub 256k 128k 5
// it means if subscriber delayed to receive over 256k or
// 128k continuously 5 sec,
// redis disconnects subscriber
// we publish over 100M data for making situation for exceed
// client-output-buffer-limit
String veryLargeString = makeLargeString(10485760);
// 10M * 10 = 100M
for (int i = 0; i < 10 && !exit.get(); i++) {
j.publish("foo", veryLargeString);
}
j.disconnect();
} catch (Exception ex) {
}
}
});
t.start();