void TestAddServerInRuntimeImplement() { StartBootstrap(DefaultServerConfig); var bootstrap = BootStrap as IDynamicBootstrap; var options = new NameValueCollection(); options["testAtt1"] = "1"; options["testAtt2"] = "2"; Assert.IsTrue(bootstrap.AddAndStart(new ServerConfig { Name = "TestDynamicServer", ServerType = "SuperSocket.Test.TestServer, SuperSocket.Test", Port = 2013, Options = options })); EndPoint serverAddress = new IPEndPoint(IPAddress.Parse("127.0.0.1"), 2013); using (Socket socket = CreateClientSocket()) { try { socket.Connect(serverAddress); } catch { Assert.Fail("Failed to connect to the dynamic created server."); } Stream socketStream = GetSocketStream(socket); using (StreamReader reader = new StreamReader(socketStream, m_Encoding, true)) using (ConsoleWriter writer = new ConsoleWriter(socketStream, m_Encoding, 1024 * 8)) { string welcomeString = reader.ReadLine(); Assert.AreEqual(string.Format(TestSession.WelcomeMessageFormat, "TestDynamicServer"), welcomeString); var line = Guid.NewGuid().ToString(); writer.WriteLine("ECHO " + line); writer.Flush(); Assert.AreEqual(line, reader.ReadLine()); } } BootStrap.GetServerByName("TestDynamicServer").Stop(); bootstrap.Remove("TestDynamicServer"); }