Пример #1
0
        public virtual void TestJetty()
        {
            Context context = new Context();

            context.SetContextPath("/");
            context.AddServlet(typeof(TestHFSTestCase.MyServlet), "/bar");
            Server server = TestJettyHelper.GetJettyServer();

            server.AddHandler(context);
            server.Start();
            Uri url = new Uri(TestJettyHelper.GetJettyURL(), "/bar");
            HttpURLConnection conn = (HttpURLConnection)url.OpenConnection();

            NUnit.Framework.Assert.AreEqual(conn.GetResponseCode(), HttpURLConnection.HttpOk);
            BufferedReader reader = new BufferedReader(new InputStreamReader(conn.GetInputStream
                                                                                 ()));

            NUnit.Framework.Assert.AreEqual(reader.ReadLine(), "foo");
            reader.Close();
        }
Пример #2
0
 /// <exception cref="System.Exception"/>
 public virtual void TestJettyNoAnnotation2()
 {
     TestJettyHelper.GetJettyURL();
 }