public void Acknowledge() { if (state.GetType() == typeof(Established)) { state = new Listening(); } else { Console.WriteLine("状态不对,不继续执行"); } state.Acknowledge(); }
public void Close() { if (state.GetType() == typeof(Listening)) { state = new Closed(); } else { Console.WriteLine("状态不对,不继续执行"); } state.Close(); }
public void Open() { if (state == null) { state = new Established(); } else { Console.WriteLine("状态不对,不继续执行"); } state.Open(); }