01: /*
02: * Copyright (C) The Spice Group. All rights reserved.
03: *
04: * This software is published under the terms of the Spice
05: * Software License version 1.1, a copy of which has been included
06: * with this distribution in the LICENSE.txt file.
07: */
08: package org.codehaus.spice.netserve.sockets;
09:
10: import java.io.IOException;
11: import java.net.InetAddress;
12: import java.net.Socket;
13:
14: /**
15: * Service used to create client sockets. The factory is used so that
16: * the exact socket type and underlying transport is abstracted. The
17: * sockets created could be proxied, SSL enabled, TLS enabled etc.
18: * However clients just care that they return sockets.
19: *
20: * @author Peter Donald
21: * @version $Revision: 1.2 $ $Date: 2004/03/21 23:43:00 $
22: */
23: public interface SocketFactory {
24: /**
25: * Create a socket that connects to specified remote address.
26: *
27: * @param address the remote address
28: * @param port the remote port
29: * @return the socket connected to remote address
30: * @throws IOException if unable to create socket
31: */
32: Socket createSocket(InetAddress address, int port)
33: throws IOException;
34:
35: /**
36: * Create a socket that connects to specified remote address and
37: * originates from specified local address.
38: *
39: * @param address the remote address
40: * @param port the remote port
41: * @param localAddress the local address
42: * @param localPort the local port
43: * @return the socket connected to remote address
44: * @throws IOException if unable to create socket
45: */
46: Socket createSocket(InetAddress address, int port,
47: InetAddress localAddress, int localPort) throws IOException;
48: }
|