1 31 32 package org.apache.commons.httpclient.protocol; 33 34 import java.io.IOException ; 35 import java.net.InetAddress ; 36 import java.net.Socket ; 37 import java.net.UnknownHostException ; 38 39 47 public class DefaultProtocolSocketFactory implements ProtocolSocketFactory { 48 49 52 private static final DefaultProtocolSocketFactory factory = new DefaultProtocolSocketFactory(); 53 54 58 static DefaultProtocolSocketFactory getSocketFactory() { 59 return factory; 60 } 61 62 65 public DefaultProtocolSocketFactory() { 66 super(); 67 } 68 69 72 public Socket createSocket( 73 String host, 74 int port, 75 InetAddress clientHost, 76 int clientPort 77 ) throws IOException , UnknownHostException { 78 return new Socket (host, port, clientHost, clientPort); 79 } 80 81 84 public Socket createSocket(String host, int port) 85 throws IOException , UnknownHostException { 86 return new Socket (host, port); 87 } 88 89 92 public boolean equals(Object obj) { 93 return ((obj != null) && obj.getClass().equals(DefaultProtocolSocketFactory.class)); 94 } 95 96 99 public int hashCode() { 100 return DefaultProtocolSocketFactory.class.hashCode(); 101 } 102 103 } 104 | Popular Tags |