01: /*
02: * $Id: HTTPSessionTest.java 6825 2006-04-04 03:00:44Z dfs $
03: *
04: * Copyright 2006 Daniel F. Savarese
05: *
06: * Licensed under the Apache License, Version 2.0 (the "License");
07: * you may not use this file except in compliance with the License.
08: * You may obtain a copy of the License at
09: *
10: * http://www.savarese.org/software/ApacheLicense-2.0
11: *
12: * Unless required by applicable law or agreed to in writing, software
13: * distributed under the License is distributed on an "AS IS" BASIS,
14: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15: * See the License for the specific language governing permissions and
16: * limitations under the License.
17: */
18:
19: package org.savarese.barehttp;
20:
21: import java.io.*;
22:
23: /**
24: * Tests the HTTPSession class by making use of {@link HTTPTestCase}
25: * fixtures, issuing requests from a ByteInputStream, and storing the
26: * replies in a ByteArrayOutputStream.
27: *
28: * @author <a href="http://www.savarese.org/">Daniel F. Savarese</a>
29: */
30: public class HTTPSessionTest extends HTTPTestCase {
31:
32: public HTTPSessionTest() throws IOException {
33: }
34:
35: byte[] issueRequest(String request) throws IOException {
36: ByteArrayInputStream in = new ByteArrayInputStream(request
37: .getBytes("US-ASCII"));
38: ByteArrayOutputStream out = new ByteArrayOutputStream(
39: MAX_FILE_SIZE << 1);
40:
41: HTTPSession session = new HTTPSession(docroot, in, out);
42: session.execute();
43:
44: return out.toByteArray();
45: }
46:
47: }
|