View Javadoc

1   //
2   //  ========================================================================
3   //  Copyright (c) 1995-2013 Mort Bay Consulting Pty. Ltd.
4   //  ------------------------------------------------------------------------
5   //  All rights reserved. This program and the accompanying materials
6   //  are made available under the terms of the Eclipse Public License v1.0
7   //  and Apache License v2.0 which accompanies this distribution.
8   //
9   //      The Eclipse Public License is available at
10  //      http://www.eclipse.org/legal/epl-v10.html
11  //
12  //      The Apache License v2.0 is available at
13  //      http://www.opensource.org/licenses/apache2.0.php
14  //
15  //  You may elect to redistribute this code under either of these licenses.
16  //  ========================================================================
17  //
18  
19  
20  package org.eclipse.jetty.spdy;
21  
22  import java.io.IOException;
23  
24  import org.eclipse.jetty.io.AsyncEndPoint;
25  import org.eclipse.jetty.io.Buffer;
26  import org.eclipse.jetty.io.Connection;
27  import org.eclipse.jetty.util.thread.Timeout;
28  
29  public class EmptyAsyncEndPoint implements AsyncEndPoint
30  {
31      private boolean checkForIdle;
32      private Connection connection;
33      private boolean oshut;
34      private boolean ishut;
35      private boolean closed;
36      private int maxIdleTime;
37  
38      @Override
39      public void dispatch()
40      {
41      }
42      
43      @Override
44      public void asyncDispatch()
45      {
46      }
47  
48      @Override
49      public void scheduleWrite()
50      {
51      }
52  
53      @Override
54      public void onIdleExpired(long idleForMs)
55      {
56      }
57  
58      @Override
59      public void setCheckForIdle(boolean check)
60      {
61          this.checkForIdle = check;
62      }
63  
64      @Override
65      public boolean isCheckForIdle()
66      {
67          return checkForIdle;
68      }
69  
70      @Override
71      public boolean isWritable()
72      {
73          return false;
74      }
75  
76      @Override
77      public boolean hasProgressed()
78      {
79          return false;
80      }
81  
82      @Override
83      public void scheduleTimeout(Timeout.Task task, long timeoutMs)
84      {
85      }
86  
87      @Override
88      public void cancelTimeout(Timeout.Task task)
89      {
90      }
91  
92      @Override
93      public Connection getConnection()
94      {
95          return connection;
96      }
97  
98      @Override
99      public void setConnection(Connection connection)
100     {
101         this.connection = connection;
102     }
103 
104     @Override
105     public void shutdownOutput() throws IOException
106     {
107         oshut = true;
108     }
109 
110     @Override
111     public boolean isOutputShutdown()
112     {
113         return oshut;
114     }
115 
116     @Override
117     public void shutdownInput() throws IOException
118     {
119         ishut = true;
120     }
121 
122     @Override
123     public boolean isInputShutdown()
124     {
125         return ishut;
126     }
127 
128     @Override
129     public void close() throws IOException
130     {
131         closed = true;
132     }
133 
134     @Override
135     public int fill(Buffer buffer) throws IOException
136     {
137         return 0;
138     }
139 
140     @Override
141     public int flush(Buffer buffer) throws IOException
142     {
143         return 0;
144     }
145 
146     @Override
147     public int flush(Buffer header, Buffer buffer, Buffer trailer) throws IOException
148     {
149         return 0;
150     }
151 
152     @Override
153     public String getLocalAddr()
154     {
155         return null;
156     }
157 
158     @Override
159     public String getLocalHost()
160     {
161         return null;
162     }
163 
164     @Override
165     public int getLocalPort()
166     {
167         return -1;
168     }
169 
170     @Override
171     public String getRemoteAddr()
172     {
173         return null;
174     }
175 
176     @Override
177     public String getRemoteHost()
178     {
179         return null;
180     }
181 
182     @Override
183     public int getRemotePort()
184     {
185         return -1;
186     }
187 
188     @Override
189     public boolean isBlocking()
190     {
191         return false;
192     }
193 
194     @Override
195     public boolean blockReadable(long millisecs) throws IOException
196     {
197         return false;
198     }
199 
200     @Override
201     public boolean blockWritable(long millisecs) throws IOException
202     {
203         return false;
204     }
205 
206     @Override
207     public boolean isOpen()
208     {
209         return !closed;
210     }
211 
212     @Override
213     public Object getTransport()
214     {
215         return null;
216     }
217 
218     @Override
219     public void flush() throws IOException
220     {
221     }
222 
223     @Override
224     public int getMaxIdleTime()
225     {
226         return maxIdleTime;
227     }
228 
229     @Override
230     public void setMaxIdleTime(int timeMs) throws IOException
231     {
232         this.maxIdleTime = timeMs;
233     }
234 }