static void Main(string[] args)
        {
            Console.WriteLine("Client: Executing the client code with a real Internet:");

            IInternet internet = new RealInternet();

            try
            {
                internet.ConnectTo("craftcode.com");
                internet.ConnectTo("abc.com");
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }

            internet = new ProxyInternet(new RealInternet());

            try
            {
                internet.ConnectTo("craftcode.com");
                internet.ConnectTo("abc.com");
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }
        }
示例#2
0
        static void Main(string[] args)
        {
            IInternet internet = new ProxyInternet();

            internet.ConnectTo("UTM.md");
            internet.ConnectTo("abc.com");
            internet.ConnectTo("xxx.com");
            internet.ConnectTo("ati.moodle.md");

            Console.ReadLine();
        }