public void Connect() { logger.Log(LogLevel.Info, String.Format("Connecting to {0}:{1}", serverName, portNumber)); socket = new Socket(SocketType.Stream, ProtocolType.Tcp); socket.Connect(serverName, portNumber); messageFactory = new MessageFactory(); messageBuffer = new MessageBuffer(delimiter); }
public void TestHalfReceivedMessages() { var buffer = new MessageBuffer("_"); buffer.Input("Foxtrot_Unicorn_Ch"); CollectionAssert.AreEqual(new String[]{"Foxtrot","Unicorn"},buffer.ReadMessages().ToArray()); Assert.AreEqual(0, buffer.ReadMessages().Count()); buffer.Input("arlie_Kilo_"); CollectionAssert.AreEqual(new String[] { "Charlie", "Kilo" }, buffer.ReadMessages().ToArray()); }