@Test
public void testOverrideObserver() throws InterruptedException {

    ConsumerConfig<?> consumerConfig = new ConsumerConfig();
    consumerConfig.setInterfaceId(TEST_SERVICE_NAME)
        .setUniqueId("unique123Id")
        .setApplication(new ApplicationConfig().setAppName("test-server"))
        .setProxy("javassist")
        .setSubscribe(true)
        .setSerialization("java")
        .setInvokeType("sync")
        .setTimeout(4444);
    // 订阅Consumer Config
    CountDownLatch latch = new CountDownLatch(1);
    MockConfigListener configListener = new MockConfigListener();
    configListener.setCountDownLatch(latch);
    registry.subscribeOverride(consumerConfig, configListener);
    Map<String, String> attributes = new ConcurrentHashMap<String, String>();
    attributes.put(RpcConstants.CONFIG_KEY_TIMEOUT, "3333");
    attributes.put(RpcConstants.CONFIG_KEY_APP_NAME, "test-server");
    attributes.put(RpcConstants.CONFIG_KEY_SERIALIZATION, "java");
    configListener.attrUpdated(attributes);
    Map<String, String> configData = configListener.getData();
    Assert.assertEquals(3, configData.size());
    consumerConfig.setInterfaceId(TEST_SERVICE_NAME)
        .setUniqueId("unique123Id")
        .setApplication(new ApplicationConfig().setAppName("test-server1"))
        .setProxy("javassist")
        .setSubscribe(true)
        .setSerialization("java")
        .setInvokeType("sync")
        .setTimeout(5555);
    configListener = new MockConfigListener();
    configListener.setCountDownLatch(latch);
    registry.subscribeOverride(consumerConfig, configListener);
    attributes.put(RpcConstants.CONFIG_KEY_TIMEOUT, "4444");
    attributes.put(RpcConstants.CONFIG_KEY_APP_NAME, "test-server2");
    configListener.attrUpdated(attributes);
    configData = configListener.getData();
    Assert.assertEquals(3, configData.size());
    latch.await(2000, TimeUnit.MILLISECONDS);
    Assert.assertEquals(3, configData.size());
}