1 /*
2 * Copyright 1999,2004 The Apache Software Foundation.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17 package org.apache.commons.feedparser.network;
18
19 import java.io.IOException;
20 import java.io.InputStream;
21
22 /**
23 *
24 * A blocking request that waits for a specified or random amount of time.
25 *
26 * SCHEME - block://localhost/?duration=100
27 *
28 * @author <a href="mailto:burton@openprivacy.org">Kevin A. Burton</a>
29 * @version $Id: BlockingResourceRequest.java 373622 2006-01-30 22:53:00Z mvdb $
30 */
31 public class BlockingResourceRequest extends BaseResourceRequest implements ResourceRequest {
32
33 public static final String SCHEME = "block";
34
35 /**
36 *
37 *
38 */
39 public void init() throws IOException {
40
41 String resource = getResource();
42
43 }
44
45 /**
46 *
47 *
48 *
49 */
50 public InputStream getInputStream() throws IOException {
51
52 try {
53
54 Thread.sleep( 100 );
55
56 return null;
57
58 } catch ( Throwable t ) {
59
60 IOException e = new IOException( t.getMessage() );
61 e.initCause( t );
62
63 throw e;
64
65 }
66
67 }
68
69 public static void main( String[] args ) {
70
71 try {
72
73 } catch ( Throwable t ) {
74
75 t.printStackTrace();
76
77 }
78
79 }
80
81 }
82