1 18 package org.drftpd.tests; 19 20 import java.io.ByteArrayOutputStream ; 21 import java.io.IOException ; 22 import java.io.InputStream ; 23 import java.io.OutputStream ; 24 import java.net.InetAddress ; 25 import java.net.Socket ; 26 import java.net.SocketAddress ; 27 import java.net.SocketException ; 28 import java.net.SocketImpl ; 29 import java.net.UnknownHostException ; 30 import java.nio.channels.SocketChannel ; 31 32 36 public class DummySocket extends Socket { 37 38 private ByteArrayOutputStream _out = new ByteArrayOutputStream (); 39 public ByteArrayOutputStream getByteArrayOutputStream() { 40 return _out; 41 } 42 public DummySocket() { 43 } 44 45 public DummySocket(SocketImpl impl) throws SocketException { 46 throw new UnsupportedOperationException (); 47 } 48 49 public DummySocket(String host, int port) 50 throws UnknownHostException , IOException { 51 throw new UnsupportedOperationException (); 52 } 53 54 public DummySocket(InetAddress address, int port) throws IOException { 55 throw new UnsupportedOperationException (); 56 } 57 58 public DummySocket( 59 String host, 60 int port, 61 InetAddress localAddr, 62 int localPort) 63 throws IOException { 64 throw new UnsupportedOperationException (); 65 } 66 67 public DummySocket( 68 InetAddress address, 69 int port, 70 InetAddress localAddr, 71 int localPort) 72 throws IOException { 73 throw new UnsupportedOperationException (); 74 } 75 76 public DummySocket(String host, int port, boolean stream) 77 throws IOException { 78 throw new UnsupportedOperationException (); 79 } 80 81 public DummySocket(InetAddress host, int port, boolean stream) 82 throws IOException { 83 throw new UnsupportedOperationException (); 84 } 85 86 89 90 public void bind(SocketAddress bindpoint) throws IOException { 91 throw new UnsupportedOperationException (); 92 } 93 94 public synchronized void close() throws IOException { 95 } 96 97 100 101 public void connect(SocketAddress endpoint, int timeout) 102 throws IOException { 103 throw new UnsupportedOperationException (); 104 } 105 106 public void connect(SocketAddress endpoint) throws IOException { 107 } 108 109 112 113 public SocketChannel getChannel() { 114 throw new UnsupportedOperationException (); 115 } 116 117 118 121 122 public InetAddress getInetAddress() { 123 return getLocalAddress(); 124 } 125 126 129 130 public InputStream getInputStream() throws IOException { 131 throw new UnsupportedOperationException (); 132 } 133 134 137 138 public boolean getKeepAlive() throws SocketException { 139 throw new UnsupportedOperationException (); 140 } 141 142 public InetAddress getLocalAddress() { 143 try { 144 return InetAddress.getByName("127.0.0.1"); 145 } catch (UnknownHostException e) { 146 throw new RuntimeException (e); 147 } 148 } 149 150 153 154 public int getLocalPort() { 155 throw new UnsupportedOperationException (); 156 } 157 158 161 162 public SocketAddress getLocalSocketAddress() { 163 throw new UnsupportedOperationException (); 164 } 165 166 169 170 public boolean getOOBInline() throws SocketException { 171 throw new UnsupportedOperationException (); 172 } 173 174 177 178 public OutputStream getOutputStream() throws IOException { 179 return _out; 180 } 181 182 185 186 public int getPort() { 187 throw new UnsupportedOperationException (); 188 } 189 190 193 194 public synchronized int getReceiveBufferSize() throws SocketException { 195 throw new UnsupportedOperationException (); 196 } 197 198 201 202 public SocketAddress getRemoteSocketAddress() { 203 throw new UnsupportedOperationException (); 204 } 205 206 209 210 public boolean getReuseAddress() throws SocketException { 211 throw new UnsupportedOperationException (); 212 } 213 214 217 218 public synchronized int getSendBufferSize() throws SocketException { 219 throw new UnsupportedOperationException (); 220 } 221 222 225 226 public int getSoLinger() throws SocketException { 227 throw new UnsupportedOperationException (); 228 } 229 230 233 234 public synchronized int getSoTimeout() throws SocketException { 235 throw new UnsupportedOperationException (); 236 } 237 238 241 242 public boolean getTcpNoDelay() throws SocketException { 243 throw new UnsupportedOperationException (); 244 } 245 246 249 250 public int getTrafficClass() throws SocketException { 251 throw new UnsupportedOperationException (); 252 } 253 254 257 258 public boolean isBound() { 259 throw new UnsupportedOperationException (); 260 } 261 262 265 266 public boolean isClosed() { 267 throw new UnsupportedOperationException (); 268 } 269 270 273 274 public boolean isConnected() { 275 throw new UnsupportedOperationException (); 276 } 277 278 281 282 public boolean isInputShutdown() { 283 throw new UnsupportedOperationException (); 284 } 285 286 289 290 public boolean isOutputShutdown() { 291 throw new UnsupportedOperationException (); 292 } 293 294 297 298 public void sendUrgentData(int data) throws IOException { 299 throw new UnsupportedOperationException (); 300 } 301 302 303 306 307 public void setKeepAlive(boolean on) throws SocketException { 308 throw new UnsupportedOperationException (); 309 } 310 311 314 315 public void setOOBInline(boolean on) throws SocketException { 316 throw new UnsupportedOperationException (); 317 } 318 319 322 323 public synchronized void setReceiveBufferSize(int size) 324 throws SocketException { 325 throw new UnsupportedOperationException (); 326 } 327 328 331 332 public void setReuseAddress(boolean on) throws SocketException { 333 throw new UnsupportedOperationException (); 334 } 335 336 339 340 public synchronized void setSendBufferSize(int size) 341 throws SocketException { 342 throw new UnsupportedOperationException (); 343 } 344 345 348 349 public void setSoLinger(boolean on, int linger) throws SocketException { 350 throw new UnsupportedOperationException (); 351 } 352 353 356 357 public synchronized void setSoTimeout(int timeout) throws SocketException { 358 } 359 360 363 364 public void setTcpNoDelay(boolean on) throws SocketException { 365 throw new UnsupportedOperationException (); 366 } 367 368 371 372 public void setTrafficClass(int tc) throws SocketException { 373 throw new UnsupportedOperationException (); 374 } 375 376 379 380 public void shutdownInput() throws IOException { 381 throw new UnsupportedOperationException (); 382 } 383 384 387 388 public void shutdownOutput() throws IOException { 389 throw new UnsupportedOperationException (); 390 } 391 392 } 393 | Popular Tags |