KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > drftpd > tests > DummyServerSocketFactory


1 /*
2  * This file is part of DrFTPD, Distributed FTP Daemon.
3  *
4  * DrFTPD is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * (at your option) any later version.
8  *
9  * DrFTPD is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with DrFTPD; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  */

18 package org.drftpd.tests;
19
20 import java.io.IOException JavaDoc;
21 import java.net.InetAddress JavaDoc;
22 import java.net.ServerSocket JavaDoc;
23 import java.net.Socket JavaDoc;
24
25 import javax.net.ServerSocketFactory;
26
27 /**
28  * @author mog
29  * @version $Id: DummyServerSocketFactory.java,v 1.1 2004/05/16 18:07:31 mog Exp $
30  */

31 public class DummyServerSocketFactory extends ServerSocketFactory {
32     private DummySocketFactory _dssf;
33
34     public DummyServerSocketFactory(DummySocketFactory dssf) {
35         _dssf = dssf;
36     }
37
38     public ServerSocket JavaDoc createServerSocket() {
39         try {
40             return new ServerSocket JavaDoc() {
41                 public Socket JavaDoc accept() {
42                     return getDummySocket();
43                 }
44             };
45         } catch (IOException JavaDoc e) {
46             throw new RuntimeException JavaDoc(e);
47         }
48     }
49     public ServerSocket JavaDoc createServerSocket(int arg0) throws IOException JavaDoc {
50         return createServerSocket();
51     }
52
53     public ServerSocket JavaDoc createServerSocket(int arg0, int arg1)
54         throws IOException JavaDoc {
55         return createServerSocket();
56     }
57
58     public ServerSocket JavaDoc createServerSocket(
59         int arg0,
60         int arg1,
61         InetAddress JavaDoc arg2)
62         throws IOException JavaDoc {
63         return createServerSocket();
64     }
65
66     public DummySocket getDummySocket() {
67         return _dssf.getDummySocket();
68     }
69
70 }
71
Popular Tags