SocketFactory.java revision 93102446a7b7c3d17888064b4e2e4e5cb534e6d0
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 */ 16package org.mockftpserver.core.socket; 17 18import java.io.IOException; 19import java.net.InetAddress; 20import 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: 95 $ - $Date: 2007-10-30 22:05:41 -0400 (Tue, 30 Oct 2007) $ 27 * 28 * @author Chris Mair 29 */ 30public 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}