1 /* Reattore HTTP Server 2 3 Copyright (C) 2002 Michael Hope <michaelh@juju.net.nz> 4 5 This program is free software; you can redistribute it and/or modify 6 it under the terms of the GNU General Public License as published by 7 the Free Software Foundation; either version 2 of the License, or 8 (at your option) any later version. 9 10 This program is distributed in the hope that it will be useful, 11 but WITHOUT ANY WARRANTY; without even the implied warranty of 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 GNU General Public License for more details. 14 15 You should have received a copy of the GNU General Public License 16 along with this program; if not, write to the Free Software 17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 19 $Id: TestHttpParserText.java,v 1.1 2003/02/09 02:20:39 michaelh Exp $ 20 */ 21 22 package test.juju.reattore.protocol.http.impl; 23 24 import junit.framework.*; 25 import org.apache.commons.logging.*; 26 27 import juju.reattore.protocol.http.HttpParser; 28 import juju.reattore.protocol.http.HttpConstants; 29 30 public class TestHttpParserText 31 extends HttpParserBase { 32 33 public void testPlain() 34 throws Exception { 35 36 add("GET / HTTP/1.1\r\n" 37 + "Trailer: 123\r\n" 38 + "\r\n"); 39 40 expect(HttpConstants.TRAILER, "123"); 41 } 42 43 public void testFolding() 44 throws Exception { 45 46 add("GET / HTTP/1.1\r\n" 47 + "Trailer: 123\r\n" 48 + " 456\r\n" 49 + "\r\n"); 50 51 expect(HttpConstants.TRAILER, "123 456"); 52 } 53 54 public void testCase1() 55 throws Exception { 56 57 add("GET / HTTP/1.1\r\n" 58 + "trailer: 123\r\n" 59 + "\r\n"); 60 61 expect(HttpConstants.TRAILER, "123"); 62 } 63 64 public void testCase2() 65 throws Exception { 66 67 add("GET / HTTP/1.1\r\n" 68 + "traILer: 1234\r\n" 69 + "\r\n"); 70 71 expect(HttpConstants.TRAILER, "1234"); 72 } 73 74 public void testExtraLWS() 75 throws Exception { 76 77 add("GET / HTTP/1.1\r\n" 78 + "Trailer: 1234 \r\n" 79 + "\r\n"); 80 81 expect(HttpConstants.TRAILER, "1234"); 82 } 83 84 public static Test suite() { 85 return new TestSuite(TestHttpParserText.class); 86 } 87 }

This page was automatically generated by Maven