当前位置: 首页>>代码示例>>Java>>正文


Java ControllerThreadSocketFactory类代码示例

本文整理汇总了Java中org.apache.commons.httpclient.protocol.ControllerThreadSocketFactory的典型用法代码示例。如果您正苦于以下问题:Java ControllerThreadSocketFactory类的具体用法?Java ControllerThreadSocketFactory怎么用?Java ControllerThreadSocketFactory使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ControllerThreadSocketFactory类属于org.apache.commons.httpclient.protocol包,在下文中一共展示了ControllerThreadSocketFactory类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createSocket

import org.apache.commons.httpclient.protocol.ControllerThreadSocketFactory; //导入依赖的package包/类
public Socket createSocket(
    final String host,
    final int port,
    final InetAddress localAddress,
    final int localPort,
    final HttpConnectionParams params
) throws IOException, UnknownHostException {
    
    if (params == null) {
        throw new IllegalArgumentException("Parameters may not be null");
    }
    int timeout = params.getConnectionTimeout();
    ControllerThreadSocketFactory.SocketTask task = new ControllerThreadSocketFactory.SocketTask() {
        public void doit() throws IOException {
            synchronized (this) {
                try {
                    this.wait(delay);
                } catch (InterruptedException e) {}
            }
            setSocket(realFactory.createSocket(host, port, localAddress, localPort));
        }
    };
    return ControllerThreadSocketFactory.createSocket(task, timeout);
}
 
开发者ID:jenkinsci,项目名称:lib-commons-httpclient,代码行数:25,代码来源:TestHttpConnection.java

示例2: createSocket

import org.apache.commons.httpclient.protocol.ControllerThreadSocketFactory; //导入依赖的package包/类
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();
    if (timeout == 0) {
        return createSocket(host, port, localAddress, localPort);
    } else {
        // To be eventually deprecated when migrated to Java 1.4 or above
        return ControllerThreadSocketFactory.createSocket(
                this, host, port, localAddress, localPort, timeout);
    }
}
 
开发者ID:jenkinsci,项目名称:lib-commons-httpclient,代码行数:20,代码来源:SimpleSSLTestProtocolSocketFactory.java

示例3: createSocket

import org.apache.commons.httpclient.protocol.ControllerThreadSocketFactory; //导入依赖的package包/类
/**
 * Attempts to get a new socket connection to the given host within the given time limit.
 * <p>
 * To circumvent the limitations of older JREs that do not support connect timeout a
 * controller thread is executed. The controller thread attempts to create a new socket
 * within the given limit of time. If socket constructor does not return until the
 * timeout expires, the controller terminates and throws an {@link ConnectTimeoutException}
 * </p>
 *
 * @param host         the host name/IP
 * @param port         the port on the host
 * @param localAddress the local host name/IP to bind the socket to
 * @param localPort    the port on the local machine
 * @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 {
    if (params == null)
    {
        throw new IllegalArgumentException("Parameters may not be null");
    }
    int timeout = params.getConnectionTimeout();
    if (timeout == 0)
    {
        return createSocket(host, port, localAddress, localPort);
    }
    else
    {
        // To be eventually deprecated when migrated to Java 1.4 or above
        return ControllerThreadSocketFactory.createSocket(this, host, port, localAddress, localPort, timeout);
    }
}
 
开发者ID:apache,项目名称:flex-blazeds,代码行数:40,代码来源:EasySSLProtocolSocketFactory.java

示例4: createSocket

import org.apache.commons.httpclient.protocol.ControllerThreadSocketFactory; //导入依赖的package包/类
/**
 * Attempts to get a new socket connection to the given host within the given time limit.
 * <p>
 * This method employs several techniques to circumvent the limitations of older JREs that 
 * do not support connect timeout. When running in JRE 1.4 or above reflection is used to 
 * call Socket#connect(SocketAddress endpoint, int timeout) method. When executing in older 
 * JREs a controller thread is executed. The controller thread attempts to create a new socket
 * within the given limit of time. If socket constructor does not return until the timeout 
 * expires, the controller terminates and throws an {@link ConnectTimeoutException}
 * </p>
 *  
 * @param host the host name/IP
 * @param port the port on the host
 * @param clientHost the local host name/IP to bind the socket to
 * @param clientPort the port on the local machine
 * @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();
    if (timeout == 0) {
        return createSocket(host, port, localAddress, localPort);
    } else {
        // To be eventually deprecated when migrated to Java 1.4 or above
        SSLSocket sslSocket = (SSLSocket) ReflectionSocketFactory.createSocket(
            "javax.net.ssl.SSLSocketFactory", host, port, localAddress, localPort, timeout);
        if (sslSocket == null) {
            sslSocket = (SSLSocket) ControllerThreadSocketFactory.createSocket(
                this, host, port, localAddress, localPort, timeout);
        }
        verifyHostname(sslSocket);
        return sslSocket;
    }
}
 
开发者ID:magneticmoon,项目名称:httpclient3-ntml,代码行数:49,代码来源:StrictSSLProtocolSocketFactory.java

示例5: createSocket

import org.apache.commons.httpclient.protocol.ControllerThreadSocketFactory; //导入依赖的package包/类
/**
 * Attempts to get a new socket connection to the given host within the given time limit.
 * <p/>
 * To circumvent the limitations of older JREs that do not support connect timeout a
 * controller thread is executed. The controller thread attempts to create a new socket
 * within the given limit of time. If socket constructor does not return until the
 * timeout expires, the controller terminates and throws an {@link ConnectTimeoutException}
 * </p>
 *
 * @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 {
    if (params == null) {
        throw new IllegalArgumentException("Parameters may not be null");
    }
    int timeout = params.getConnectionTimeout();
    if (timeout == 0) {
        return createSocket(host, port, localAddress, localPort);
    }
    else {
        // To be eventually deprecated when migrated to Java 1.4 or above
        return ControllerThreadSocketFactory.createSocket(
                this, host, port, localAddress, localPort, timeout);
    }
}
 
开发者ID:visit,项目名称:spark-svn-mirror,代码行数:38,代码来源:EasySSLProtocolSocketFactory.java

示例6: createSocket

import org.apache.commons.httpclient.protocol.ControllerThreadSocketFactory; //导入依赖的package包/类
@Override
public Socket createSocket(String host, int port, InetAddress localAddress, int localPort, HttpConnectionParams params) throws IOException {
    
    if (params == null) {
        throw new IllegalArgumentException("Parameters may not be null");
    }
    int timeout = params.getConnectionTimeout();
    if (timeout == 0) {
        return createSocket(host, port, localAddress, localPort);
    } else {
        return ControllerThreadSocketFactory.createSocket(
                this, host, port, localAddress, localPort, timeout);
    }
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:15,代码来源:SSLContextParametersSecureProtocolSocketFactory.java

示例7: createSocket

import org.apache.commons.httpclient.protocol.ControllerThreadSocketFactory; //导入依赖的package包/类
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();
    if (timeout == 0) {
        return createSocket(host, port, localAddress, localPort);
    } else {
        return ControllerThreadSocketFactory.createSocket(this, host, port, localAddress, localPort, timeout);
    }
}
 
开发者ID:fangrenbin,项目名称:wechat4j,代码行数:12,代码来源:MySecureProtocolSocketFactory.java

示例8: createSocket

import org.apache.commons.httpclient.protocol.ControllerThreadSocketFactory; //导入依赖的package包/类
/**
 * Attempts to get a new socket connection to the given host within the given
 * time limit.
 * <p>
 * To circumvent the limitations of older JREs that do not support connect
 * timeout a controller thread is executed. The controller thread attempts to
 * create a new socket within the given limit of time. If socket constructor
 * does not return until the timeout expires, the controller terminates and
 * throws an {@link ConnectTimeoutException}
 * </p>
 * 
 * @param host
 *          the host name/IP
 * @param port
 *          the port on the host
 * @param localAddress
 *          the local host name/IP to bind the socket to
 * @param localPort
 *          the port on the local machine
 * @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();
  if (timeout == 0) {
    return createSocket(host, port, localAddress, localPort);
  } else {
    // To be eventually deprecated when migrated to Java 1.4 or above
    return ControllerThreadSocketFactory.createSocket(this, host, port,
        localAddress, localPort, timeout);
  }
}
 
开发者ID:jorcox,项目名称:GeoCrawler,代码行数:46,代码来源:DummySSLProtocolSocketFactory.java

示例9: createSocket

import org.apache.commons.httpclient.protocol.ControllerThreadSocketFactory; //导入依赖的package包/类
/**
 * Attempts to get a new socket connection to the given host within the given time limit.
 * <p>
 * To circumvent the limitations of older JREs that do not support connect timeout a controller thread is executed.
 * The controller thread attempts to create a new socket within the given limit of time. If socket constructor does
 * not return until the timeout expires, the controller terminates and throws an {@link ConnectTimeoutException}
 * </p>
 * 
 * @param host
 *            the host name/IP
 * @param port
 *            the port on the host
 * @param clientHost
 *            the local host name/IP to bind the socket to
 * @param clientPort
 *            the port on the local machine
 * @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();
    if (timeout == 0) {
        return createSocket(host, port, localAddress, localPort);
    } else {
        // To be eventually deprecated when migrated to Java 1.4 or above
        return ControllerThreadSocketFactory.createSocket(
                this, host, port, localAddress, localPort, timeout);
    }
}
 
开发者ID:intuit,项目名称:Tank,代码行数:46,代码来源:EasySSLProtocolSocketFactory.java

示例10: createSocket

import org.apache.commons.httpclient.protocol.ControllerThreadSocketFactory; //导入依赖的package包/类
/**
 * Attempts to get a new socket connection to the given host within the given time limit.
 * <p>
 * To circumvent the limitations of older JREs that do not support connect timeout a 
 * controller thread is executed. The controller thread attempts to create a new socket 
 * within the given limit of time. If socket constructor does not return until the 
 * timeout expires, the controller terminates and throws an {@link ConnectTimeoutException}
 * </p>
 *  
 * @param host the host name/IP
 * @param port the port on the host
 * @param clientHost the local host name/IP to bind the socket to
 * @param clientPort the port on the local machine
 * @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();
    if (timeout == 0) {
        return createSocket(host, port, localAddress, localPort);
    } else {
        // To be eventually deprecated when migrated to Java 1.4 or above
        return ControllerThreadSocketFactory.createSocket(
                this, host, port, localAddress, localPort, timeout);
    }
}
 
开发者ID:magneticmoon,项目名称:httpclient3-ntml,代码行数:41,代码来源:AuthSSLProtocolSocketFactory.java

示例11: createSocket

import org.apache.commons.httpclient.protocol.ControllerThreadSocketFactory; //导入依赖的package包/类
/**
 * Attempts to get a new socket connection to the given host within the given time limit.
 * <p>
 * This method employs several techniques to circumvent the limitations of older JREs that 
 * do not support connect timeout. When running in JRE 1.4 or above reflection is used to 
 * call Socket#connect(SocketAddress endpoint, int timeout) method. When executing in older 
 * JREs a controller thread is executed. The controller thread attempts to create a new socket
 * within the given limit of time. If socket constructor does not return until the timeout 
 * expires, the controller terminates and throws an {@link ConnectTimeoutException}
 * </p>
 *  
 * @param host the host name/IP
 * @param port the port on the host
 * @param localAddress the local host name/IP to bind the socket to
 * @param localPort the port on the local machine
 * @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
 * 
 * @author Copied from HttpClient 3.0.1 SSLProtocolSocketFactory
 * @since 3.0
 */
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();
	if (timeout == 0) {
		return createSocket(host, port, localAddress, localPort);
	}
	// To be eventually deprecated when migrated to Java 1.4 or above
	Socket socket = ReflectionSocketFactory.createSocket(
		"javax.net.ssl.SSLSocketFactory", host, port, localAddress, localPort, timeout);
	if (socket == null) {
		socket = ControllerThreadSocketFactory.createSocket(
			this, host, port, localAddress, localPort, timeout);
	}
	return socket;
}
 
开发者ID:ibissource,项目名称:iaf,代码行数:44,代码来源:AuthSSLProtocolSocketFactoryForJsse10x.java

示例12: createSocket

import org.apache.commons.httpclient.protocol.ControllerThreadSocketFactory; //导入依赖的package包/类
/**
 * Attempts to get a new socket connection to the given host within the
 * given time limit.
 * <p>
 * To circumvent the limitations of older JREs that do not support connect
 * timeout a controller thread is executed. The controller thread attempts
 * to create a new socket within the given limit of time. If socket
 * constructor does not return until the timeout expires, the controller
 * terminates and throws an {@link ConnectTimeoutException}
 * </p>
 * 
 * @param host
 *            the host name/IP
 * @param port
 *            the port on the host
 * @param clientHost
 *            the local host name/IP to bind the socket to
 * @param clientPort
 *            the port on the local machine
 * @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();
	if (timeout == 0) {
		return this.createSocket(host, port, localAddress, localPort);
	} else {
		// To be eventually deprecated when migrated to Java 1.4 or above
		return ControllerThreadSocketFactory.createSocket(this, host, port,
				localAddress, localPort, timeout);
	}
}
 
开发者ID:lablita,项目名称:ridire-cpi,代码行数:46,代码来源:EasySSLProtocolSocketFactory.java

示例13: createSocket

import org.apache.commons.httpclient.protocol.ControllerThreadSocketFactory; //导入依赖的package包/类
/**
 * Attempts to get a new socket connection to the given host within the given
 * time limit.
 * <p>
 * To circumvent the limitations of older JREs that do not support connect
 * timeout a controller thread is executed. The controller thread attempts to
 * create a new socket within the given limit of time. If socket constructor
 * does not return until the timeout expires, the controller terminates and
 * throws an {@link ConnectTimeoutException}
 * </p>
 * 
 * @param host the host name/IP
 * @param port the port on the host
 * @param localAddress the local host name/IP to bind the socket to
 * @param localPort the port on the local machine
 * @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();
  if (timeout == 0) {
    return createSocket(host, port, localAddress, localPort);
  } else {
    // To be eventually deprecated when migrated to Java 1.4 or above
    return ControllerThreadSocketFactory.createSocket(this, host, port, localAddress, localPort, timeout);
  }
}
 
开发者ID:yahoo,项目名称:anthelion,代码行数:37,代码来源:DummySSLProtocolSocketFactory.java

示例14: createSocket

import org.apache.commons.httpclient.protocol.ControllerThreadSocketFactory; //导入依赖的package包/类
/**
 * Attempts to get a new socket connection to the given host within the
 * given time limit.
 * 
 * <p>
 * To circumvent the limitations of older JREs that do not support connect
 * timeout a controller thread is executed. The controller thread attempts
 * to create a new socket within the given limit of time. If socket
 * constructor does not return until the timeout expires, the controller
 * terminates and throws an {@link ConnectTimeoutException}
 * </p>
 * 
 * @param host
 *            the host name/IP
 * @param port
 *            the port on the host
 * @param localAddress
 *            the local host name/IP to bind the socket to
 * @param localPort
 *            the port on the local machine
 * @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
 * @throws ConnectTimeoutException
 *             DOCUMENT ME!
 * @throws IllegalArgumentException
 *             DOCUMENT ME!
 */
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();

    if (timeout == 0) {
        return createSocket(host, port, localAddress, localPort);
    } else {
        // To be eventually deprecated when migrated to Java 1.4 or above
        return ControllerThreadSocketFactory.createSocket(this, host, port, localAddress, localPort, timeout);
    }
}
 
开发者ID:apache,项目名称:kylin,代码行数:49,代码来源:DefaultSslProtocolSocketFactory.java

示例15: createSocket

import org.apache.commons.httpclient.protocol.ControllerThreadSocketFactory; //导入依赖的package包/类
/**
 * Attempts to get a new socket connection to the given host within the
 * given time limit.
 * <p>
 * To circumvent the limitations of older JREs that do not support connect
 * timeout a controller thread is executed. The controller thread attempts
 * to create a new socket within the given limit of time. If socket
 * constructor does not return until the timeout expires, the controller
 * terminates and throws an {@link ConnectTimeoutException}
 * </p>
 * 
 * @param host
 *            the host name/IP
 * @param port
 *            the port on the host
 * @param clientHost
 *            the local host name/IP to bind the socket to
 * @param clientPort
 *            the port on the local machine
 * @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();
	if (timeout == 0) {
		return createSocket(host, port, localAddress, localPort);
	} else {
		// To be eventually deprecated when migrated to Java 1.4 or above
		return ControllerThreadSocketFactory.createSocket(this, host, port, localAddress, localPort, timeout);
	}
}
 
开发者ID:NCIP,项目名称:cagrid-core,代码行数:41,代码来源:EasySSLProtocolSocketFactory.java


注:本文中的org.apache.commons.httpclient.protocol.ControllerThreadSocketFactory类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。