XMemcachedConstructorWithComplexArgInterceptor implements InstanceConstructorInterceptor { @Override public void onConstruct(EnhancedInstance objInst, Object[] allArguments) { StringBuilder memcachConnInfo = new StringBuilder(); @SuppressWarnings("unchecked") Map<InetSocketAddress, InetSocketAddress> inetSocketAddressMap = (Map<InetSocketAddress, InetSocketAddress>) allArguments[6]; for (Entry<InetSocketAddress, InetSocketAddress> entry : inetSocketAddressMap.entrySet()) { memcachConnInfo = append(memcachConnInfo, entry.getKey()); memcachConnInfo = append(memcachConnInfo, entry.getValue()); } Integer length = memcachConnInfo.length(); if (length > 1) { memcachConnInfo = new StringBuilder(memcachConnInfo.substring(0, length - 1)); } objInst.setSkyWalkingDynamicField(memcachConnInfo.toString()); }  @Override void onConstruct(EnhancedInstance objInst, Object[] allArguments);  }
@Test public void onConstructWithComplex() { Map<InetSocketAddress, InetSocketAddress> inetSocketAddressMap = new HashMap<InetSocketAddress, InetSocketAddress>(); inetSocketAddressMap.put(new InetSocketAddress("127.0.0.1", 11211), new InetSocketAddress("127.0.0.2", 11211)); interceptor.onConstruct(enhancedInstance, new Object[] { null, null, null, null, null, null, inetSocketAddressMap }); verify(enhancedInstance).setSkyWalkingDynamicField("127.0.0.1:11211;127.0.0.2:11211"); }