Package javax.net

Examples of javax.net.SocketFactory


   * @return a socket factory
   */
  public static SocketFactory getSocketFactory(Configuration conf,
      Class<?> clazz) {

    SocketFactory factory = null;

    String propValue =
        conf.get("hadoop.rpc.socket.factory.class." + clazz.getSimpleName());
    if ((propValue != null) && (propValue.length() > 0))
      factory = getSocketFactoryFromProperty(conf, propValue);
View Full Code Here


                localLocation = new URI(localString);
            } catch (Exception e) {
                LOG.warn("path isn't a valid local location for SslTransport to use", e);
            }
        }
        SocketFactory socketFactory = createSocketFactory();
        return new SslTransport(wf, (SSLSocketFactory)socketFactory, location, localLocation, false);
    }
View Full Code Here

                localLocation = new URI(localString);
            } catch (Exception e) {
                LOG.warn("path isn't a valid local location for TcpTransport to use", e);
            }
        }
        SocketFactory socketFactory = createSocketFactory();
        return createTcpTransport(wf, socketFactory, location, localLocation);
    }
View Full Code Here

    }   

    public Connection createConnection(String host, int port) throws IOException {
        try {
            Socket socket;
            SocketFactory socketFactory;
            socketFactory = config.getUsingSSL() ? SSLSocketFactory.getDefault() : SocketFactory.getDefault();
            if (config.getHttpProxyHost() != null) {
                socket = socketFactory.createSocket(config.getHttpProxyHost(), config.getHttpProxyPort());
                connectProxy(host, port, socket);
            } else {
                socket = socketFactory.createSocket(host, port);
            }
            return new SocketConnection(socket);

        } catch (Exception e) {
            throw new IOException(e.getMessage());
View Full Code Here

       
        //create a connection to the slave.
        s = (Socket)
        AccessController.doPrivileged(new PrivilegedExceptionAction() {
            public Object run() throws IOException {
                SocketFactory sf = SocketFactory.getDefault();
                InetSocketAddress sockAddr = new InetSocketAddress(
                        slaveAddress.getHostAddress(),
                        slaveAddress.getPortNumber());
                Socket s_temp = sf.createSocket();
                s_temp.connect(sockAddr, timeout_);
                return s_temp;
            }
        });
       
View Full Code Here

   */
  public Socket createSocket(String host, int port, InetAddress localAddress,
      int localPort, HttpConnectionParams params) throws IOException,
      UnknownHostException, ConnectTimeoutException {
    int timeout = QQConstants.HTTP_TIME_OUT;
    SocketFactory socketfactory = getSSLContext().getSocketFactory();
    if (timeout == 0) {
      return socketfactory.createSocket(host, port, localAddress,
          localPort);
    } else {
      Socket socket = socketfactory.createSocket();
      SocketAddress localaddr = new InetSocketAddress(localAddress,
          localPort);
      SocketAddress remoteaddr = new InetSocketAddress(host, port);
      socket.bind(localaddr);
      socket.connect(remoteaddr, timeout);
View Full Code Here

            HttpConnectionParams connParams) throws IOException {
        if (connParams == null) {
            throw new IllegalArgumentException("Parameters may not be null");
        }
        int timeout = connParams.getConnectionTimeout();
        SocketFactory socketfactory = sslContext.getSocketFactory();
        if (timeout == 0) {
            return socketfactory.createSocket(host, port, localHost, localPort);
        } else {
            Socket socket = socketfactory.createSocket();
            SocketAddress localaddr = new InetSocketAddress(localHost, localPort);
            SocketAddress remoteaddr = new InetSocketAddress(host, port);
            socket.bind(localaddr);
            socket.connect(remoteaddr, timeout);
            return socket;
View Full Code Here

   * @return a socket factory
   */
  public static SocketFactory getSocketFactory(Configuration conf,
      Class<?> clazz) {

    SocketFactory factory = null;

    String propValue =
        conf.get("hadoop.rpc.socket.factory.class." + clazz.getSimpleName());
    if ((propValue != null) && (propValue.length() > 0))
      factory = getSocketFactoryFromProperty(conf, propValue);
View Full Code Here

   /**
    * @see org.jboss.remoting.security.SSLSocketBuilderMBean#createSSLSocketFactory(org.jboss.remoting.security.CustomSSLSocketFactory)
    */
   public SocketFactory createSSLSocketFactory(CustomSSLSocketFactory wrapper) throws IOException
   {
      SocketFactory sf = null;

      if (getUseSSLSocketFactory())
      {
         String defaultFactoryName = System.getProperty(REMOTING_DEFAULT_SOCKET_FACTORY_CLASS);
         if (defaultFactoryName != null)
View Full Code Here

      {
         createSocketFactorySSLContext();
         initializeSocketFactorySSLContext();
      }

      SocketFactory sf = sslContextSocketFactory.getSocketFactory();

      wrapper.setFactory((SSLSocketFactory) sf);

      return wrapper;
   }
View Full Code Here

TOP

Related Classes of javax.net.SocketFactory

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.