public class NonBindingSocketFactory extends Object implements org.apache.commons.httpclient.protocol.ProtocolSocketFactory
The reason for this ProtocolSocketFactory implementation is that for ProxyServlet we don't need to
bind to a local address and port. This binding can cause issue in PaaS environments where restrictions apply.
When HttpConnection.open() calls
ProtocolSocketFactory.createSocket(String, int, InetAddress, int, HttpConnectionParams)
which by default will use DefaultProtocolSocketFactory.createSocket(String, int, InetAddress, int, HttpConnectionParams).
The method that will be invoke is DefaultProtocolSocketFactory.createSocket(String, int, InetAddress, int, HttpConnectionParams)
which will call return new Socket(host, port, localAddress, localPort);.
The Socket.Socket(InetAddress, int, InetAddress, int) constructor will create a new Socket and connect to the
remote address and port (the first two arguments). It will also bind() to the local address and port. This is
the part that can cause issue in PaaS environment where there are restrictions.
| Constructor and Description |
|---|
NonBindingSocketFactory() |
| Modifier and Type | Method and Description |
|---|---|
Socket |
createSocket(String host,
int port) |
Socket |
createSocket(String host,
int port,
InetAddress localAddress,
int localPort) |
Socket |
createSocket(String host,
int port,
InetAddress localAddress,
int localPort,
org.apache.commons.httpclient.params.HttpConnectionParams params) |
public Socket createSocket(String host, int port, InetAddress localAddress, int localPort) throws IOException
createSocket in interface org.apache.commons.httpclient.protocol.ProtocolSocketFactoryIOExceptionpublic Socket createSocket(String host, int port, InetAddress localAddress, int localPort, org.apache.commons.httpclient.params.HttpConnectionParams params) throws IOException
createSocket in interface org.apache.commons.httpclient.protocol.ProtocolSocketFactoryIOExceptionpublic Socket createSocket(String host, int port) throws IOException
createSocket in interface org.apache.commons.httpclient.protocol.ProtocolSocketFactoryIOExceptionCopyright © 2011–2015 Red Hat. All rights reserved.