--- /dev/null
+/* Copyright (C)2013 Pantheon Technologies, s.r.o. All rights reserved. */\r
+package org.opendaylight.openflowjava.protocol.impl.serialization.factories;\r
+\r
+import io.netty.buffer.ByteBuf;\r
+\r
+import org.opendaylight.openflowjava.protocol.impl.core.OFFrameDecoder;\r
+import org.opendaylight.openflowjava.protocol.impl.serialization.OFSerializer;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.EchoInput;\r
+\r
+/**\r
+ * @author michal.polkorab\r
+ *\r
+ */\r
+public class EchoInputMessageFactory implements OFSerializer<EchoInput> {\r
+\r
+ /** Code type of EchoRequest message */\r
+ public static final byte MESSAGE_TYPE = 2;\r
+ private static EchoInputMessageFactory instance;\r
+ \r
+ private EchoInputMessageFactory() {\r
+ // do nothing, just singleton\r
+ }\r
+ \r
+ /**\r
+ * @return singleton factory\r
+ */\r
+ public static EchoInputMessageFactory getInstance() {\r
+ if (instance == null) {\r
+ instance = new EchoInputMessageFactory();\r
+ }\r
+ return instance;\r
+ }\r
+\r
+ @Override\r
+ public void messageToBuffer(short version, ByteBuf out, EchoInput message) {\r
+ out.writeByte(message.getVersion());\r
+ out.writeByte(MESSAGE_TYPE);\r
+ out.writeShort(OFFrameDecoder.LENGTH_OF_HEADER);\r
+ out.writeInt(message.getXid().intValue());\r
+ }\r
+ \r
+}\r