@Test
public void getRegistry() {

    try {
        RegistryConfig registryConfig = new RegistryConfig().setProtocol("test111");
        Registry registry = RegistryFactory.getRegistry(registryConfig);
        Assert.fail();
    } catch (Exception e) {
        Assert.assertTrue(e instanceof SofaRpcRuntimeException);
    }
    {
        RegistryConfig registryConfig = new RegistryConfig().setProtocol("test");
        Registry registry = RegistryFactory.getRegistry(registryConfig);
        Assert.assertTrue(registry instanceof TestRegistry);
        registry.destroy(new Destroyable.DestroyHook() {
            @Override
            public void preDestroy() {
            }
            @Override
            public void postDestroy() {
            }
        });
    }
    for (int i = 0; i < 3; i++) {
        RegistryConfig registryConfig = new RegistryConfig().setProtocol("test").setTimeout(1000 + i);
        Registry registry = RegistryFactory.getRegistry(registryConfig);
        Assert.assertTrue(registry instanceof TestRegistry);
    }
    Assert.assertTrue(RegistryFactory.getRegistries().size() == 4);
    RegistryFactory.destroyAll();
}