The best way to do this is to actually fake the device.
Example...
[{"id":"d0ed337.b37dbd","type":"tcp in","z":"62dd2f0711b4f336","name":"Fake TCP device:1025","server":"server","host":"","port":"1025","datamode":"stream","datatype":"buffer","newline":"\\n","topic":"text","base64":false,"tls":"","x":620,"y":1140,"wires":[["ef1f8f592f30c415"]]},{"id":"c4fce4d0.df1838","type":"tcp out","z":"62dd2f0711b4f336","name":"reply: all open connections will be messaged","host":"","port":"","beserver":"reply","base64":false,"end":false,"tls":"","x":1710,"y":1160,"wires":[]},{"id":"7de967f0.d50a08","type":"tcp request","z":"62dd2f0711b4f336","name":"Send command to TCP Device","server":"localhost","port":"1025","out":"time","ret":"buffer","splitc":"100","newline":"","tls":"","x":750,"y":1480,"wires":[["33b50ec6a7d19f8c","3172d13778f65792"]]},{"id":"ef1f8f592f30c415","type":"switch","z":"62dd2f0711b4f336","name":"Test Command is L or W","property":"payload[0]","propertyType":"msg","rules":[{"t":"eq","v":"76","vt":"num"},{"t":"eq","v":"78","vt":"num"},{"t":"else"}],"checkall":"true","repair":false,"outputs":3,"x":690,"y":1080,"wires":[["0ff8a391ce298b2c"],["a647359b690ce1f2"],["1066a7a015c405ae"]]},{"id":"8f14c1c0a2f1dd14","type":"change","z":"62dd2f0711b4f336","name":"","rules":[{"t":"set","p":"lastCommand","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1280,"y":1040,"wires":[["80b2699cfc2ed208"]]},{"id":"1066a7a015c405ae","type":"switch","z":"62dd2f0711b4f336","name":"is STX?","property":"payload[0]","propertyType":"msg","rules":[{"t":"eq","v":"1","vt":"num"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":940,"y":1120,"wires":[["288fbabfce2bfaec"],["acc8c62738c99972"]]},{"id":"288fbabfce2bfaec","type":"function","z":"62dd2f0711b4f336","name":"Prepare response (TODO)","func":"var lastCommand = flow.get(\"lastCommand\");\nvar len = Number(lastCommand.byteCount);\nvar buf = Buffer.alloc(len)\nif (lastCommand.command == \"L\") {\n for (let i = 0; i < len; i++) {\n const v = rand(65,90)\n buf.writeUInt8(v,i);\n }\n msg.payload = buf;\n}\n\nreturn msg;\n\n\n\nfunction rand(min, max) {\n return Math.floor(min + Math.random() * (max + 1 - min))\n}","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1220,"y":1120,"wires":[["95d2e329b3fc8d7b"]]},{"id":"80b2699cfc2ed208","type":"change","z":"62dd2f0711b4f336","name":"Set ACK","rules":[{"t":"set","p":"payload","pt":"msg","to":"[6]","tot":"bin"}],"action":"","property":"","from":"","to":"","reg":false,"x":1460,"y":1040,"wires":[["c4fce4d0.df1838"]]},{"id":"0ff8a391ce298b2c","type":"buffer-parser","z":"62dd2f0711b4f336","name":"Parse L command","data":"payload","dataType":"msg","specification":"spec","specificationType":"ui","items":[{"type":"ascii","name":"command","offset":0,"length":1,"offsetbit":0,"scale":"1","mask":""},{"type":"string","name":"startAddress","offset":1,"length":6,"offsetbit":0,"scale":"1","mask":""},{"type":"string","name":"byteCount","offset":7,"length":6,"offsetbit":0,"scale":"1","mask":""},{"type":"ascii","name":"headNo","offset":13,"length":1,"offsetbit":0,"scale":"1","mask":""},{"type":"uint8","name":"BCC","offset":15,"length":1,"offsetbit":0,"scale":"1","mask":""}],"swap1":"","swap2":"","swap3":"","swap1Type":"swap","swap2Type":"swap","swap3Type":"swap","msgProperty":"payload","msgPropertyType":"str","resultType":"keyvalue","resultTypeType":"return","multipleResult":false,"fanOutMultipleResult":false,"setTopic":true,"outputs":1,"x":970,"y":1020,"wires":[["8f14c1c0a2f1dd14","f7f5d12de11aeade"]]},{"id":"a647359b690ce1f2","type":"buffer-parser","z":"62dd2f0711b4f336","name":"Parse W command (TODO)","data":"payload","dataType":"msg","specification":"spec","specificationType":"ui","items":[{"type":"buffer","name":"item1","offset":0,"length":-1,"offsetbit":0,"scale":"1","mask":""}],"swap1":"","swap2":"","swap3":"","swap1Type":"swap","swap2Type":"swap","swap3Type":"swap","msgProperty":"payload","msgPropertyType":"str","resultType":"keyvalue","resultTypeType":"return","multipleResult":false,"fanOutMultipleResult":false,"setTopic":true,"outputs":1,"x":1000,"y":1060,"wires":[["8f14c1c0a2f1dd14","1a5f4d450eb8d2ca"]]},{"id":"1b3cc0f132ae6ca1","type":"inject","z":"62dd2f0711b4f336","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":480,"y":1340,"wires":[["ad1d238796790dff"]]},{"id":"ad1d238796790dff","type":"buffer-maker","z":"62dd2f0711b4f336","name":"Command 'L'","specification":"spec","specificationType":"ui","items":[{"name":"Command","type":"ascii","length":1,"dataType":"str","data":"L"},{"name":"StartAddr","type":"ascii","length":6,"dataType":"str","data":"000000"},{"name":"NoofBytes","type":"ascii","length":6,"dataType":"str","data":"001024"},{"name":"HeadNo","type":"ascii","length":1,"dataType":"str","data":"1"},{"name":"Reserve","type":"ascii","length":1,"dataType":"str","data":"R"},{"name":"BCC","type":"byte","length":1,"dataType":"num","data":"0"}],"swap1":"","swap2":"","swap3":"","swap1Type":"swap","swap2Type":"swap","swap3Type":"swap","msgProperty":"payload","msgPropertyType":"str","x":630,"y":1340,"wires":[["6aca84b711a30260"]]},{"id":"6aca84b711a30260","type":"function","z":"62dd2f0711b4f336","name":"Calc BCC","func":"function calculateBcc(messageBytes, countOfBytes) {\n let loopCount = 0;\n let bccValue = 0x00;\n for (loopCount = 0; loopCount < countOfBytes; loopCount++) {\n bccValue = bccValue ^ messageBytes[loopCount];\n }\n return (bccValue & 0xFF);\n}\nconst len = msg.payload.length;\nconst BCC = calculateBcc(msg.payload, len - 1)\n\n//write BCC to the buffer in last position\nmsg.payload.writeInt8(BCC, len - 1)\n\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":860,"y":1360,"wires":[["a87d67637ce96238"]]},{"id":"a0a58c5af2d2e845","type":"inject","z":"62dd2f0711b4f336","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":480,"y":1400,"wires":[["383b078841f93c48"]]},{"id":"383b078841f93c48","type":"buffer-maker","z":"62dd2f0711b4f336","name":"Command 'W' (TODO)","specification":"spec","specificationType":"ui","items":[{"name":"Command","type":"ascii","length":1,"dataType":"str","data":"W"},{"name":"StartAddr","type":"ascii","length":6,"dataType":"str","data":"000000"},{"name":"NoofBytes","type":"ascii","length":6,"dataType":"str","data":"001024"},{"name":"HeadNo","type":"ascii","length":1,"dataType":"str","data":"1"},{"name":"Reserve","type":"ascii","length":1,"dataType":"str","data":"R"},{"name":"BCC","type":"byte","length":1,"dataType":"num","data":"0"}],"swap1":"","swap2":"","swap3":"","swap1Type":"swap","swap2Type":"swap","swap3Type":"swap","msgProperty":"payload","msgPropertyType":"str","x":660,"y":1400,"wires":[["6aca84b711a30260"]]},{"id":"33b50ec6a7d19f8c","type":"switch","z":"62dd2f0711b4f336","name":"is ACK, NAK, Other?","property":"payload[0]","propertyType":"msg","rules":[{"t":"eq","v":"6","vt":"num"},{"t":"eq","v":"21","vt":"num"},{"t":"else"}],"checkall":"true","repair":false,"outputs":3,"x":1020,"y":1480,"wires":[["bdb523b99989e21f"],["8a3511d98cb0d51c"],["3b6b53b5e85512b2"]]},{"id":"af79b6f83fc7b11e","type":"tcp request","z":"62dd2f0711b4f336","name":"Send command to TCP Device","server":"localhost","port":"1025","out":"time","ret":"buffer","splitc":"100","newline":"","tls":"","x":1490,"y":1400,"wires":[["8d14c4116d47f497"]]},{"id":"bdb523b99989e21f","type":"change","z":"62dd2f0711b4f336","name":"Set STX","rules":[{"t":"set","p":"payload","pt":"msg","to":"[1]","tot":"bin"}],"action":"","property":"","from":"","to":"","reg":false,"x":1260,"y":1400,"wires":[["af79b6f83fc7b11e","a6eb4228c7fe7b98"]]},{"id":"16a40457ee83d33b","type":"debug","z":"62dd2f0711b4f336","name":"4: Result","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1900,"y":1480,"wires":[]},{"id":"f7f5d12de11aeade","type":"debug","z":"62dd2f0711b4f336","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1210,"y":1000,"wires":[]},{"id":"1a5f4d450eb8d2ca","type":"debug","z":"62dd2f0711b4f336","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1210,"y":1080,"wires":[]},{"id":"acc8c62738c99972","type":"function","z":"62dd2f0711b4f336","name":"Prepare Error response (TODO)","func":"\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1190,"y":1160,"wires":[["c4fce4d0.df1838"]]},{"id":"3b6b53b5e85512b2","type":"function","z":"62dd2f0711b4f336","name":"Prepare Error Log (TODO)","func":"node.error(\"Unexpected response from device\", msg);\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1300,"y":1520,"wires":[[]]},{"id":"8a3511d98cb0d51c","type":"function","z":"62dd2f0711b4f336","name":"NAK - Prepare Error for Log (TODO)","func":"node.error(\"NAK response from device\", msg);\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1330,"y":1480,"wires":[[]]},{"id":"dccda30af7322067","type":"debug","z":"62dd2f0711b4f336","name":"1: To Device","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1070,"y":1320,"wires":[]},{"id":"7fd40b8c13dff1b3","type":"debug","z":"62dd2f0711b4f336","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":950,"y":960,"wires":[]},{"id":"3172d13778f65792","type":"debug","z":"62dd2f0711b4f336","name":"2: From Device","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":800,"y":1520,"wires":[]},{"id":"a6eb4228c7fe7b98","type":"debug","z":"62dd2f0711b4f336","name":"3: Send STX to device","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1440,"y":1360,"wires":[]},{"id":"95d2e329b3fc8d7b","type":"function","z":"62dd2f0711b4f336","name":"Calc BCC","func":"function calculateBcc(messageBytes, countOfBytes) {\n let loopCount = 0;\n let bccValue = 0x00;\n for (loopCount = 0; loopCount < countOfBytes; loopCount++) {\n bccValue = bccValue ^ messageBytes[loopCount];\n }\n return (bccValue & 0xFF);\n}\nconst len = msg.payload.length;\nconst BCC = calculateBcc(msg.payload, len - 1)\n\n//write BCC to the buffer in last position\nmsg.payload.writeInt8(BCC, len - 1)\n\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1440,"y":1120,"wires":[["c4fce4d0.df1838"]]},{"id":"8d14c4116d47f497","type":"switch","z":"62dd2f0711b4f336","name":"Test Command is L or W","property":"thisCommand[0]","propertyType":"msg","rules":[{"t":"eq","v":"76","vt":"num"},{"t":"eq","v":"78","vt":"num"},{"t":"else"}],"checkall":"true","repair":false,"outputs":3,"x":1610,"y":1460,"wires":[["38d94462d8a0c58e"],[],[]]},{"id":"38d94462d8a0c58e","type":"buffer-parser","z":"62dd2f0711b4f336","name":"Parse L result","data":"payload","dataType":"msg","specification":"spec","specificationType":"ui","items":[{"type":"buffer","name":"item1","offset":0,"length":-1,"offsetbit":0,"scale":"1","mask":""}],"swap1":"","swap2":"","swap3":"","swap1Type":"swap","swap2Type":"swap","swap3Type":"swap","msgProperty":"payload","msgPropertyType":"str","resultType":"keyvalue","resultTypeType":"return","multipleResult":false,"fanOutMultipleResult":false,"setTopic":true,"outputs":1,"x":1840,"y":1440,"wires":[["16a40457ee83d33b"]]},{"id":"a87d67637ce96238","type":"change","z":"62dd2f0711b4f336","name":"store command","rules":[{"t":"set","p":"thisCommand","pt":"msg","to":"payload","tot":"msg","dc":true}],"action":"","property":"","from":"","to":"","reg":false,"x":1020,"y":1360,"wires":[["dccda30af7322067","7de967f0.d50a08"]]}]