001: /*
002: * This file is part of DrFTPD, Distributed FTP Daemon.
003: *
004: * DrFTPD is free software; you can redistribute it and/or modify
005: * it under the terms of the GNU General Public License as published by
006: * the Free Software Foundation; either version 2 of the License, or
007: * (at your option) any later version.
008: *
009: * DrFTPD is distributed in the hope that it will be useful,
010: * but WITHOUT ANY WARRANTY; without even the implied warranty of
011: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
012: * GNU General Public License for more details.
013: *
014: * You should have received a copy of the GNU General Public License
015: * along with DrFTPD; if not, write to the Free Software
016: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
017: */
018: package org.drftpd.tests;
019:
020: import java.io.ByteArrayOutputStream;
021: import java.io.IOException;
022: import java.io.InputStream;
023: import java.io.OutputStream;
024:
025: import java.net.InetAddress;
026: import java.net.Socket;
027: import java.net.SocketAddress;
028: import java.net.SocketException;
029: import java.net.SocketImpl;
030: import java.net.UnknownHostException;
031:
032: import java.nio.channels.SocketChannel;
033:
034: /**
035: * @author mog
036: * @version $Id: DummySocket.java 690 2004-08-03 20:14:12Z zubov $
037: */
038: public class DummySocket extends Socket {
039: private ByteArrayOutputStream _out = new ByteArrayOutputStream();
040:
041: public DummySocket() {
042: }
043:
044: public DummySocket(SocketImpl impl) throws SocketException {
045: throw new UnsupportedOperationException();
046: }
047:
048: public DummySocket(String host, int port)
049: throws UnknownHostException, IOException {
050: throw new UnsupportedOperationException();
051: }
052:
053: public DummySocket(InetAddress address, int port)
054: throws IOException {
055: throw new UnsupportedOperationException();
056: }
057:
058: public DummySocket(String host, int port, InetAddress localAddr,
059: int localPort) throws IOException {
060: throw new UnsupportedOperationException();
061: }
062:
063: public DummySocket(InetAddress address, int port,
064: InetAddress localAddr, int localPort) throws IOException {
065: throw new UnsupportedOperationException();
066: }
067:
068: public DummySocket(String host, int port, boolean stream)
069: throws IOException {
070: throw new UnsupportedOperationException();
071: }
072:
073: public DummySocket(InetAddress host, int port, boolean stream)
074: throws IOException {
075: throw new UnsupportedOperationException();
076: }
077:
078: public ByteArrayOutputStream getByteArrayOutputStream() {
079: return _out;
080: }
081:
082: /**
083: *
084: */
085: public void bind(SocketAddress bindpoint) throws IOException {
086: throw new UnsupportedOperationException();
087: }
088:
089: public synchronized void close() throws IOException {
090: }
091:
092: /**
093: *
094: */
095: public void connect(SocketAddress endpoint, int timeout)
096: throws IOException {
097: throw new UnsupportedOperationException();
098: }
099:
100: public void connect(SocketAddress endpoint) throws IOException {
101: }
102:
103: /**
104: *
105: */
106: public SocketChannel getChannel() {
107: throw new UnsupportedOperationException();
108: }
109:
110: /**
111: *
112: */
113: public InetAddress getInetAddress() {
114: return getLocalAddress();
115: }
116:
117: /**
118: *
119: */
120: public InputStream getInputStream() throws IOException {
121: throw new UnsupportedOperationException();
122: }
123:
124: /**
125: *
126: */
127: public boolean getKeepAlive() throws SocketException {
128: throw new UnsupportedOperationException();
129: }
130:
131: public InetAddress getLocalAddress() {
132: try {
133: return InetAddress.getByName("127.0.0.1");
134: } catch (UnknownHostException e) {
135: throw new RuntimeException(e);
136: }
137: }
138:
139: /**
140: *
141: */
142: public int getLocalPort() {
143: throw new UnsupportedOperationException();
144: }
145:
146: /**
147: *
148: */
149: public SocketAddress getLocalSocketAddress() {
150: throw new UnsupportedOperationException();
151: }
152:
153: /**
154: *
155: */
156: public boolean getOOBInline() throws SocketException {
157: throw new UnsupportedOperationException();
158: }
159:
160: /**
161: *
162: */
163: public OutputStream getOutputStream() throws IOException {
164: return _out;
165: }
166:
167: /**
168: *
169: */
170: public int getPort() {
171: throw new UnsupportedOperationException();
172: }
173:
174: /**
175: *
176: */
177: public synchronized int getReceiveBufferSize()
178: throws SocketException {
179: throw new UnsupportedOperationException();
180: }
181:
182: /**
183: *
184: */
185: public SocketAddress getRemoteSocketAddress() {
186: throw new UnsupportedOperationException();
187: }
188:
189: /**
190: *
191: */
192: public boolean getReuseAddress() throws SocketException {
193: throw new UnsupportedOperationException();
194: }
195:
196: /**
197: *
198: */
199: public synchronized int getSendBufferSize() throws SocketException {
200: throw new UnsupportedOperationException();
201: }
202:
203: /**
204: *
205: */
206: public int getSoLinger() throws SocketException {
207: throw new UnsupportedOperationException();
208: }
209:
210: /**
211: *
212: */
213: public synchronized int getSoTimeout() throws SocketException {
214: throw new UnsupportedOperationException();
215: }
216:
217: /**
218: *
219: */
220: public boolean getTcpNoDelay() throws SocketException {
221: throw new UnsupportedOperationException();
222: }
223:
224: /**
225: *
226: */
227: public int getTrafficClass() throws SocketException {
228: throw new UnsupportedOperationException();
229: }
230:
231: /**
232: *
233: */
234: public boolean isBound() {
235: throw new UnsupportedOperationException();
236: }
237:
238: /**
239: *
240: */
241: public boolean isClosed() {
242: throw new UnsupportedOperationException();
243: }
244:
245: /**
246: *
247: */
248: public boolean isConnected() {
249: throw new UnsupportedOperationException();
250: }
251:
252: /**
253: *
254: */
255: public boolean isInputShutdown() {
256: throw new UnsupportedOperationException();
257: }
258:
259: /**
260: *
261: */
262: public boolean isOutputShutdown() {
263: throw new UnsupportedOperationException();
264: }
265:
266: /**
267: *
268: */
269: public void sendUrgentData(int data) throws IOException {
270: throw new UnsupportedOperationException();
271: }
272:
273: /**
274: *
275: */
276: public void setKeepAlive(boolean on) throws SocketException {
277: throw new UnsupportedOperationException();
278: }
279:
280: /**
281: *
282: */
283: public void setOOBInline(boolean on) throws SocketException {
284: throw new UnsupportedOperationException();
285: }
286:
287: /**
288: *
289: */
290: public synchronized void setReceiveBufferSize(int size)
291: throws SocketException {
292: throw new UnsupportedOperationException();
293: }
294:
295: /**
296: *
297: */
298: public void setReuseAddress(boolean on) throws SocketException {
299: throw new UnsupportedOperationException();
300: }
301:
302: /**
303: *
304: */
305: public synchronized void setSendBufferSize(int size)
306: throws SocketException {
307: throw new UnsupportedOperationException();
308: }
309:
310: /**
311: *
312: */
313: public void setSoLinger(boolean on, int linger)
314: throws SocketException {
315: throw new UnsupportedOperationException();
316: }
317:
318: /**
319: *
320: */
321: public synchronized void setSoTimeout(int timeout)
322: throws SocketException {
323: }
324:
325: /**
326: *
327: */
328: public void setTcpNoDelay(boolean on) throws SocketException {
329: throw new UnsupportedOperationException();
330: }
331:
332: /**
333: *
334: */
335: public void setTrafficClass(int tc) throws SocketException {
336: throw new UnsupportedOperationException();
337: }
338:
339: /**
340: *
341: */
342: public void shutdownInput() throws IOException {
343: throw new UnsupportedOperationException();
344: }
345:
346: /**
347: *
348: */
349: public void shutdownOutput() throws IOException {
350: throw new UnsupportedOperationException();
351: }
352: }
|