RabbitMQProducerAndConsumerConstructorInterceptor implements InstanceConstructorInterceptor { @Override public void onConstruct(EnhancedInstance objInst, Object[] allArguments) { Connection connection = (Connection) allArguments[0]; String url = connection.getAddress().toString().replace("/", "") + ":" + connection.getPort(); objInst.setSkyWalkingDynamicField(url); }  @Override void onConstruct(EnhancedInstance objInst, Object[] allArguments);  }
@Test public void TestRabbitMQConsumerAndProducerConstructorInterceptor() { rabbitMQProducerAndConsumerConstructorInterceptor = new RabbitMQProducerAndConsumerConstructorInterceptor(); rabbitMQProducerAndConsumerConstructorInterceptor.onConstruct(enhancedInstance, new Object[] {testConnection}); assertThat((String) enhancedInstance.getSkyWalkingDynamicField(), is("127.0.0.1:5672")); }