public void checkPipeline(String protocol, ChannelPipeline pipeline, ChannelBuffer buf) throws Exception { Object tmp = buf.duplicate(); // Frame decoder FrameDecoder frameDecoder = (FrameDecoder) pipeline.get("frameDecoder"); if (frameDecoder != null) { try { Method method = frameDecoder .getClass() .getDeclaredMethod( "decode", ChannelHandlerContext.class, Channel.class, ChannelBuffer.class); method.setAccessible(true); tmp = method.invoke(frameDecoder, null, null, tmp); } catch (NoSuchMethodException error) { Method method = frameDecoder .getClass() .getSuperclass() .getDeclaredMethod( "decode", ChannelHandlerContext.class, Channel.class, ChannelBuffer.class); method.setAccessible(true); tmp = method.invoke(frameDecoder, null, null, tmp); } } // String decoder if (pipeline.get("stringDecoder") != null) { StringDecoder stringDecoder = new StringDecoder(); if (tmp != null) { try { Method method = stringDecoder .getClass() .getDeclaredMethod( "decode", ChannelHandlerContext.class, Channel.class, Object.class); method.setAccessible(true); tmp = method.invoke(stringDecoder, null, null, tmp); } catch (NoSuchMethodException error) { Method method = stringDecoder .getClass() .getSuperclass() .getDeclaredMethod( "decode", ChannelHandlerContext.class, Channel.class, Object.class); method.setAccessible(true); tmp = method.invoke(stringDecoder, null, null, tmp); } } } // Protocol decoder BaseProtocolDecoder protocolDecoder = (BaseProtocolDecoder) pipeline.get("objectDecoder"); if (tmp != null) { try { Method method = protocolDecoder .getClass() .getDeclaredMethod( "decode", ChannelHandlerContext.class, Channel.class, SocketAddress.class, Object.class); method.setAccessible(true); tmp = method.invoke(protocolDecoder, null, null, null, tmp); } catch (NoSuchMethodException error) { Method method = protocolDecoder .getClass() .getSuperclass() .getDeclaredMethod( "decode", ChannelHandlerContext.class, Channel.class, SocketAddress.class, Object.class); method.setAccessible(true); tmp = method.invoke(protocolDecoder, null, null, null, tmp); } } if (tmp != null) { Log.info("Protocol " + protocol + " possible match"); } else if (showFailed) { Log.info("Protocol " + protocol + " no match"); } }