RefererConfig extends AbstractRefererConfig { public T getRef() { if (ref == null) { initRef(); } return ref; }  String getServiceInterface(); void setServiceInterface(String serviceInterface); List<MethodConfig> getMethods(); void setMethods(List<MethodConfig> methods); void setMethods(MethodConfig methods); boolean hasMethods(); T getRef(); @SuppressWarnings({"unchecked", "rawtypes"}) synchronized void initRef(); synchronized void destroy(); void setInterface(Class<T> interfaceClass); Class<?> getInterface(); String getDirectUrl(); void setDirectUrl(String directUrl); @ConfigDesc(excluded = true) BasicRefererInterfaceConfig getBasicReferer(); void setBasicReferer(BasicRefererInterfaceConfig basicReferer); List<ClusterSupport<T>> getClusterSupports(); AtomicBoolean getInitialized();  }
@Test public void testGetRef() { MockWorld mWorld = new MockWorld(); serviceConfig.setRef(mWorld); serviceConfig.export(); IWorld ref = refererConfig.getRef(); assertNotNull(ref); assertEquals(refererConfig.getClusterSupports().size(), 1); int times = 3; for (int i = 0; i < times; i++) { ref.world("test"); } assertEquals(times, mWorld.stringCount.get()); serviceConfig.unexport(); refererConfig.destroy(); assertFalse(refererConfig.getInitialized().get()); }