JedisConstructorWithStringArgInterceptor implements InstanceConstructorInterceptor { @Override public void onConstruct(EnhancedInstance objInst, Object[] allArguments) { String host = (String) allArguments[0]; String port = "6379"; if (allArguments.length > 1) { port = String.valueOf(allArguments[1]); } objInst.setSkyWalkingDynamicField(host + ":" + port); }  @Override void onConstruct(EnhancedInstance objInst, Object[] allArguments);  }
@Test public void onConstruct() throws Exception { interceptor.onConstruct(enhancedInstance, new Object[] {"127.0.0.1"}); verify(enhancedInstance).setSkyWalkingDynamicField("127.0.0.1:6379"); }
@Test public void onConstructWithPort() { interceptor.onConstruct(enhancedInstance, new Object[] { "127.0.0.1", 16379 }); verify(enhancedInstance).setSkyWalkingDynamicField("127.0.0.1:16379"); }