public static synchronized void subscribe(String key, RpcConfigListener listener) {
        List<RpcConfigListener> listeners = CFG_LISTENER.get(key);
        if (listeners == null) {
            listeners = new ArrayList<RpcConfigListener>();
            CFG_LISTENER.put(key, listeners);
        }
        listeners.add(listener);
    }
@Test
    public void subscribe() {
        RpcConfigs.putValue("ps001", ProviderStatus.RECOVERING.toString());
        Assert.assertEquals(ProviderStatus.RECOVERING, RpcConfigs.getEnumValue("ps001", ProviderStatus.class));
        try {
            Assert.assertEquals(ProviderStatus.RECOVERING, RpcConfigs.getEnumValue("ps002", ProviderStatus.class));
            Assert.fail();
        } catch (Exception e) {
            Assert.assertTrue(e instanceof SofaRpcRuntimeException);
        } finally {
            RpcConfigs.putValue("ps001", "");
        }

        String testSubKey = "testSubKey";
        RpcConfigs.putValue(testSubKey, "111");
        String protocol = RpcConfigs.getStringValue(testSubKey);
        final Object[] values = new Object[2];
        RpcConfigs.RpcConfigListener listener = new RpcConfigs.RpcConfigListener() {
            @Override
            public void onChange(Object oldValue, Object newValue) {
                values[0] = oldValue;
                values[1] = newValue;
            }
        };
        try {
            RpcConfigs.subscribe(testSubKey, listener);

            RpcConfigs.putValue(testSubKey, "xxx");
            Assert.assertEquals(protocol, values[0]);
            Assert.assertEquals("xxx", values[1]);

            RpcConfigs.removeValue(testSubKey);
        } finally {
            RpcConfigs.removeValue(testSubKey);
            RpcConfigs.unSubscribe(testSubKey, listener);
        }
    }