@Override
        public byte[] doInTransform(Instrumentor instrumentor, ClassLoader classLoader, String className, Class<?> classBeingRedefined, ProtectionDomain protectionDomain, byte[] classfileBuffer) throws InstrumentException {
            final InstrumentClass target = instrumentor.getInstrumentClass(classLoader, className, classfileBuffer);

            // for v1.0.0+
            InstrumentMethod registerMethod = target.getDeclaredMethod("registerChannel", "java.lang.String", "java.nio.channels.SocketChannel", "int");
            if (registerMethod == null) {
                // for v1.0.0
                registerMethod = target.getDeclaredMethod("buildChannel", "java.nio.channels.SocketChannel", "java.lang.String", "java.nio.channels.SelectionKey");
            }

            if (registerMethod != null) {
                registerMethod.addInterceptor(SocketChannelRegisterInterceptor.class);

                target.addField(SocketChannelListFieldAccessor.class);
            }

            InstrumentMethod closeMethod = null;
            for (String[] selectorCloseMethodParam : SELECTOR_CLOSE_METHOD_PARAMS) {
                closeMethod = target.getDeclaredMethod("close", selectorCloseMethodParam);
                if (closeMethod != null) {
                    break;
                }
            }

            if (closeMethod != null) {
                closeMethod.addInterceptor(SocketChannelCloseInterceptor.class);
            }

            InstrumentMethod doCloseMethod = target.getDeclaredMethod("close", "org.apache.kafka.common.network.KafkaChannel", "boolean");
            if (doCloseMethod != null) {
                doCloseMethod.addInterceptor(SocketChannelCloseInterceptor.class);
            }

            return target.toBytecode();
        }
@author Harris Gwag (gwagdalf)
@author Taejin Koo
agent-module/plugins/kafka/src/main/java/com/navercorp/pinpoint/plugin/kafka/KafkaPlugin.java