There are 1 code examples for org.apache.commons.httpclient.params.HttpConnectionParams.

The API names are highlighted below. You can use suckoo button to vote the code example(s) you like. The best code example will be ranked first next time. Thanks a lot for your feedback.

Project Name: rssowl.core Package: org.rssowl.core.internal.connection

Source Code: EasySSLProtocolSocketFactory.java (Click to view .java file)

Method Code:
vote
like

/** 
 * Attempts to get a new socket connection to the given host within the given
 * time limit.
 * @param host the host name/IP
 * @param port the port on the host
 * @param params {@link HttpConnectionParams Http connection parameters}
 * @return Socket a new socket
 * @throws IOException if an I/O error occurs while creating the socket
 * @throws UnknownHostException if the IP address of the host cannot be
 * determined
 */
public Socket createSocket(final String host,final int port,final InetAddress localAddress,final int localPort,final HttpConnectionParams params) throws IOException, UnknownHostException, ConnectTimeoutException {
  if (params == null)   throw new IllegalArgumentException("Parameters may not be null");
  int timeout=params.getConnectionTimeout();
  SocketFactory socketfactory=getSSLContext().getSocketFactory();
  if (timeout == 0)   return socketfactory.createSocket(host,port,localAddress,localPort);
  Socket socket=socketfactory.createSocket();
  SocketAddress localaddr=new InetSocketAddress(localAddress,localPort);
  SocketAddress remoteaddr=new InetSocketAddress(host,port);
  socket.bind(localaddr);
  socket.connect(remoteaddr,timeout);
  return socket;
}