ClusterConstructorWithStateListenerArgInterceptor implements InstanceConstructorInterceptor { @Override public void onConstruct(EnhancedInstance objInst, Object[] allArguments) { List<InetSocketAddress> inetSocketAddresses = (List<InetSocketAddress>) allArguments[1]; StringBuilder hosts = new StringBuilder(); for (InetSocketAddress inetSocketAddress : inetSocketAddresses) { hosts.append(inetSocketAddress.getHostName() + ":" + inetSocketAddress.getPort() + ","); } String contactPoints = hosts.toString(); if (contactPoints.length() > 0) { contactPoints = contactPoints.substring(0, contactPoints.length() - 1); } objInst.setSkyWalkingDynamicField(new ConnectionInfo(contactPoints)); }  @Override void onConstruct(EnhancedInstance objInst, Object[] allArguments);  }
@Test public void onConstruct() { interceptor.onConstruct(enhancedInstance, new Object[] { "cluster-name", inetSocketAddresses }); ConnectionInfo connectionInfo = (ConnectionInfo) enhancedInstance.getSkyWalkingDynamicField(); Assert.assertThat(connectionInfo.getContactPoints(), Is.is("172.20.0.2:9042")); }