@Override
    public void lock() {
        try {
            lock(-1, null, false);
        } catch (InterruptedException e) {
            throw new IllegalStateException();
        }
    }
@Test
    public void testSubscriptionsPerConnection() throws InterruptedException {
        Config config = createConfig();
        config.useSingleServer()
                .setSubscriptionConnectionPoolSize(1)
                .setSubscriptionConnectionMinimumIdleSize(1)
                .setSubscriptionsPerConnection(1)
                .setAddress(redisson.getConfig().useSingleServer().getAddress());

        RedissonClient redisson  = Redisson.create(config);
        ExecutorService e = Executors.newFixedThreadPool(32);
        AtomicInteger errors = new AtomicInteger();
        AtomicInteger ops = new AtomicInteger();
        for (int i = 0; i < 5000; i++) {
            int j = i;
            e.submit(() -> {
                try {
                    String lockKey = "lock-" + ThreadLocalRandom.current().nextInt(5);
                    RLock lock = redisson.getLock(lockKey);
                    lock.lock();
                    Thread.sleep(ThreadLocalRandom.current().nextInt(20));
                    lock.unlock();
                    ops.incrementAndGet();
                } catch (Exception exception) {
                    exception.printStackTrace();
                    if(exception instanceof RedisTimeoutException){
                        return;
                    }
                    errors.incrementAndGet();
                }
            });
        }

        e.shutdown();
        assertThat(e.awaitTermination(150, TimeUnit.SECONDS)).isTrue();
        assertThat(errors.get()).isZero();

        RedisClientConfig cc = new RedisClientConfig();
        cc.setAddress(redisson.getConfig().useSingleServer().getAddress());
        RedisClient c = RedisClient.create(cc);
        RedisConnection ccc = c.connect();
        List<String> channels = ccc.sync(RedisCommands.PUBSUB_CHANNELS);
        assertThat(channels).isEmpty();
        c.shutdown();

        redisson.shutdown();
    }