Home | History | Annotate | Download | only in socket
      1 /*
      2  * Copyright 2007 the original author or authors.
      3  *
      4  * Licensed under the Apache License, Version 2.0 (the "License");
      5  * you may not use this file except in compliance with the License.
      6  * You may obtain a copy of the License at
      7  *
      8  *      http://www.apache.org/licenses/LICENSE-2.0
      9  *
     10  * Unless required by applicable law or agreed to in writing, software
     11  * distributed under the License is distributed on an "AS IS" BASIS,
     12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13  * See the License for the specific language governing permissions and
     14  * limitations under the License.
     15  */
     16 package org.mockftpserver.core.socket;
     17 
     18 import java.io.IOException;
     19 import java.net.InetAddress;
     20 import java.net.Socket;
     21 
     22 /**
     23  * Interface for factory that create new {@link Socket} instances.
     24  * Using this abstraction enables unit testing.
     25  *
     26  * @version $Revision$ - $Date$
     27  *
     28  * @author Chris Mair
     29  */
     30 public interface SocketFactory {
     31 
     32     /**
     33      * Create a new Socket instance for the specified host and port.
     34      * @param host - the IP address of the host endpoint to which the socket is connect
     35      * @param port - the port number of the enpoint to which the socket is connected
     36      * @return a new Socket
     37      * @throws IOException
     38      */
     39     public Socket createSocket(InetAddress host, int port) throws IOException;
     40 }