RedisConnectionMethodInterceptor implements InstanceMethodsAroundInterceptor, InstanceConstructorInterceptor { @Override public void onConstruct(EnhancedInstance objInst, Object[] allArguments) { String peer = (String) ((EnhancedInstance) allArguments[0]).getSkyWalkingDynamicField(); if (peer == null) { try { Object address = ClassUtil.getObjectField(((RedisClient) allArguments[0]).getConfig(), "address"); String host = (String) ClassUtil.getObjectField(address, "host"); String port = String.valueOf(ClassUtil.getObjectField(address, "port")); peer = host + ":" + port; } catch (Exception e) { LOGGER.warn("RedisConnection create peer error: ", e); } } objInst.setSkyWalkingDynamicField(peer); }  @Override void beforeMethod(EnhancedInstance objInst, Method method, Object[] allArguments, Class<?>[] argumentsTypes,
        MethodInterceptResult result); @Override Object afterMethod(EnhancedInstance objInst, Method method, Object[] allArguments, Class<?>[] argumentsTypes,
        Object ret); @Override void handleMethodException(EnhancedInstance objInst, Method method, Object[] allArguments,
        Class<?>[] argumentsTypes, Throwable t); @Override void onConstruct(EnhancedInstance objInst, Object[] allArguments);  }
@Test public void testIntercept() throws Throwable { interceptor.onConstruct(mockRedisConnectionInstance, new Object[] {mockRedisClientInstance}); MatcherAssert.assertThat( (String) mockRedisConnectionInstance.getSkyWalkingDynamicField(), Is.is("127.0.0.1:6379;127.0.0.1:6378;")); }