1 18 package org.drftpd.tests; 19 20 import java.io.IOException ; 21 import java.net.InetAddress ; 22 import java.net.ServerSocket ; 23 import java.net.Socket ; 24 25 import javax.net.ServerSocketFactory; 26 27 31 public class DummyServerSocketFactory extends ServerSocketFactory { 32 private DummySocketFactory _dssf; 33 34 public DummyServerSocketFactory(DummySocketFactory dssf) { 35 _dssf = dssf; 36 } 37 38 public ServerSocket createServerSocket() { 39 try { 40 return new ServerSocket () { 41 public Socket accept() { 42 return getDummySocket(); 43 } 44 }; 45 } catch (IOException e) { 46 throw new RuntimeException (e); 47 } 48 } 49 public ServerSocket createServerSocket(int arg0) throws IOException { 50 return createServerSocket(); 51 } 52 53 public ServerSocket createServerSocket(int arg0, int arg1) 54 throws IOException { 55 return createServerSocket(); 56 } 57 58 public ServerSocket createServerSocket( 59 int arg0, 60 int arg1, 61 InetAddress arg2) 62 throws IOException { 63 return createServerSocket(); 64 } 65 66 public DummySocket getDummySocket() { 67 return _dssf.getDummySocket(); 68 } 69 70 } 71 | Popular Tags |