|
|||||||||||||||||||
Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
DefaultSocketFactory.java | - | 100% | 100% | 100% |
|
1 | /* | |
2 | * Copyright (C) The Spice Group. All rights reserved. | |
3 | * | |
4 | * This software is published under the terms of the Spice | |
5 | * Software License version 1.1, a copy of which has been included | |
6 | * with this distribution in the LICENSE.txt file. | |
7 | */ | |
8 | package org.codehaus.spice.netserve.sockets.impl; | |
9 | ||
10 | import java.io.IOException; | |
11 | import java.net.InetAddress; | |
12 | import java.net.Socket; | |
13 | import org.codehaus.spice.netserve.sockets.SocketFactory; | |
14 | ||
15 | /** | |
16 | * A SocketFactory that creates vanilla sockets. | |
17 | * | |
18 | * @author Peter Donald | |
19 | * @version $Revision: 1.2 $ $Date: 2004/03/21 23:42:59 $ | |
20 | * @dna.component | |
21 | * @dna.service type="SocketFactory" | |
22 | */ | |
23 | public class DefaultSocketFactory | |
24 | implements SocketFactory | |
25 | { | |
26 | /** | |
27 | * Create a socket that connects to specified remote address. | |
28 | * | |
29 | * @param address the remote address | |
30 | * @param port the remote port | |
31 | * @return the socket connected to remote address | |
32 | * @throws IOException if unable to create socket | |
33 | */ | |
34 | 12 | public Socket createSocket( final InetAddress address, final int port ) |
35 | throws IOException | |
36 | { | |
37 | 12 | return new Socket( address, port ); |
38 | } | |
39 | ||
40 | /** | |
41 | * Create a socket that connects to specified remote address and | |
42 | * originates from specified local address. | |
43 | * | |
44 | * @param address the remote address | |
45 | * @param port the remote port | |
46 | * @param localAddress the local address | |
47 | * @param localPort the local port | |
48 | * @return the socket connected to remote address | |
49 | * @throws IOException if unable to create socket | |
50 | */ | |
51 | 9 | public Socket createSocket( final InetAddress address, |
52 | final int port, | |
53 | final InetAddress localAddress, | |
54 | final int localPort ) | |
55 | throws IOException | |
56 | { | |
57 | 9 | return new Socket( address, port, localAddress, localPort ); |
58 | } | |
59 | } |
|