View Javadoc

1   /*
2    * Copyright (c) 2012 the original author or authors.
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.eclipse.jetty.spdy;
18  
19  import java.io.IOException;
20  
21  import org.eclipse.jetty.io.AsyncEndPoint;
22  import org.eclipse.jetty.io.Buffer;
23  import org.eclipse.jetty.io.Connection;
24  import org.eclipse.jetty.util.thread.Timeout;
25  
26  public class EmptyAsyncEndPoint implements AsyncEndPoint
27  {
28      private boolean checkForIdle;
29      private Connection connection;
30      private boolean oshut;
31      private boolean ishut;
32      private boolean closed;
33      private int maxIdleTime;
34  
35      @Override
36      public void dispatch()
37      {
38      }
39      
40      @Override
41      public void asyncDispatch()
42      {
43      }
44  
45      @Override
46      public void scheduleWrite()
47      {
48      }
49  
50      @Override
51      public void onIdleExpired(long idleForMs)
52      {
53      }
54  
55      @Override
56      public void setCheckForIdle(boolean check)
57      {
58          this.checkForIdle = check;
59      }
60  
61      @Override
62      public boolean isCheckForIdle()
63      {
64          return checkForIdle;
65      }
66  
67      @Override
68      public boolean isWritable()
69      {
70          return false;
71      }
72  
73      @Override
74      public boolean hasProgressed()
75      {
76          return false;
77      }
78  
79      @Override
80      public void scheduleTimeout(Timeout.Task task, long timeoutMs)
81      {
82      }
83  
84      @Override
85      public void cancelTimeout(Timeout.Task task)
86      {
87      }
88  
89      @Override
90      public Connection getConnection()
91      {
92          return connection;
93      }
94  
95      @Override
96      public void setConnection(Connection connection)
97      {
98          this.connection = connection;
99      }
100 
101     @Override
102     public void shutdownOutput() throws IOException
103     {
104         oshut = true;
105     }
106 
107     @Override
108     public boolean isOutputShutdown()
109     {
110         return oshut;
111     }
112 
113     @Override
114     public void shutdownInput() throws IOException
115     {
116         ishut = true;
117     }
118 
119     @Override
120     public boolean isInputShutdown()
121     {
122         return ishut;
123     }
124 
125     @Override
126     public void close() throws IOException
127     {
128         closed = true;
129     }
130 
131     @Override
132     public int fill(Buffer buffer) throws IOException
133     {
134         return 0;
135     }
136 
137     @Override
138     public int flush(Buffer buffer) throws IOException
139     {
140         return 0;
141     }
142 
143     @Override
144     public int flush(Buffer header, Buffer buffer, Buffer trailer) throws IOException
145     {
146         return 0;
147     }
148 
149     @Override
150     public String getLocalAddr()
151     {
152         return null;
153     }
154 
155     @Override
156     public String getLocalHost()
157     {
158         return null;
159     }
160 
161     @Override
162     public int getLocalPort()
163     {
164         return -1;
165     }
166 
167     @Override
168     public String getRemoteAddr()
169     {
170         return null;
171     }
172 
173     @Override
174     public String getRemoteHost()
175     {
176         return null;
177     }
178 
179     @Override
180     public int getRemotePort()
181     {
182         return -1;
183     }
184 
185     @Override
186     public boolean isBlocking()
187     {
188         return false;
189     }
190 
191     @Override
192     public boolean blockReadable(long millisecs) throws IOException
193     {
194         return false;
195     }
196 
197     @Override
198     public boolean blockWritable(long millisecs) throws IOException
199     {
200         return false;
201     }
202 
203     @Override
204     public boolean isOpen()
205     {
206         return !closed;
207     }
208 
209     @Override
210     public Object getTransport()
211     {
212         return null;
213     }
214 
215     @Override
216     public void flush() throws IOException
217     {
218     }
219 
220     @Override
221     public int getMaxIdleTime()
222     {
223         return maxIdleTime;
224     }
225 
226     @Override
227     public void setMaxIdleTime(int timeMs) throws IOException
228     {
229         this.maxIdleTime = timeMs;
230     }
231 }