void processOFEchoRequest(OFChannelHandler h, OFEchoRequest m) throws IOException { if (h.ofVersion == null) { log.error("No OF version set for {}. Not sending Echo REPLY", h.channel.getRemoteAddress()); return; } OFFactory factory = (h.ofVersion == OFVersion.OF_13) ? h.controller.getOFMessageFactory13() : h.controller.getOFMessageFactory10(); OFEchoReply reply = factory .buildEchoReply() .setXid(m.getXid()) .setData(m.getData()) .build(); h.channel.write(Collections.singletonList(reply)); }