ResponseCacheTest.java revision 2244
/*
* Copyright 2003-2004 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
/* @test
* @summary Unit test for java.net.ResponseCache
* @bug 4837267
* @author Yingxian Wang
*/
/**
* Request should get serviced by the cache handler. Response get
* saved through the cache handler.
*/
public class ResponseCacheTest implements Runnable {
/*
* Our "http" server to return a 404 */
public void run() {
try {
String x;
if (x.length() ==0) {
break;
}
}
new BufferedOutputStream(
s.getOutputStream() ));
/* send file2.1 */
int len;
}
s.close();
} catch (Exception e) {
e.printStackTrace();
}
}
static class NameVerifier implements HostnameVerifier {
return true;
}
}
ResponseCacheTest() throws Exception {
/* start the server */
/* establish http connection to server */
try {
} catch (IOException ioex) {
}
String x;
new BufferedOutputStream(
new FileOutputStream(fileout)));
}
http.disconnect();
// testing ResponseCacheHandler.put()
try {
} catch (IOException ioex) {
}
out = new PrintStream(
new BufferedOutputStream(
new FileOutputStream(fileout)));
}
// assert (headers1 == headers2 && file1 == file2.2)
throw new RuntimeException("test failed");
}
}
try {
new ResponseCacheTest();
} finally{
}
}
static class MyResponseCache extends ResponseCache {
public CacheResponse
throws IOException {
}
return null;
}
// save cache to file2.cache
// 1. serialize headers into file2.cache
// 2. write data to file2.cache
}
}
static class MyCacheResponse extends CacheResponse {
try {
// throw new RuntimeException(ex.getMessage());
}
}
return fis;
}
return headers;
}
}
static class MyCacheRequest extends CacheRequest {
try {
}
}
return fos;
}
public void abort() {
// no op
}
}
}