Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
BlockingResourceRequest |
|
| 2.3333333333333335;2.333 |
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 | 0 | 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 | 0 | String resource = getResource(); |
42 | ||
43 | 0 | } |
44 | ||
45 | /** | |
46 | * | |
47 | * | |
48 | * | |
49 | */ | |
50 | public InputStream getInputStream() throws IOException { | |
51 | ||
52 | try { | |
53 | ||
54 | 0 | Thread.sleep( 100 ); |
55 | ||
56 | 0 | return null; |
57 | ||
58 | 0 | } catch ( Throwable t ) { |
59 | ||
60 | 0 | IOException e = new IOException( t.getMessage() ); |
61 | 0 | e.initCause( t ); |
62 | ||
63 | 0 | 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 | 0 | } |
78 | ||
79 | 0 | } |
80 | ||
81 | } | |
82 |