Package javax.net

Examples of javax.net.SocketFactory.createSocket()


   {
      Socket s = null;
      SocketFactory socketFactory = getSocketFactory();
      if (socketFactory != null)
      {
         s = socketFactory.createSocket();
      }
      else
      {
          s = new Socket();
      }
View Full Code Here


      SocketFactory sf = getSocketFactory();

      if (sf == null)
         sf = createSocketFactory(configuration);

      Socket s = sf.createSocket();

      s.setReuseAddress(getReuseAddress());
      InetSocketAddress inetAddr = new InetSocketAddress(address, port);
     
      if (timeout < 0)
View Full Code Here

      SocketFactory socketFactory = VirtualSocketFactory.getDefault();
      Socket socket = null;
     
      try
      {
         socket = socketFactory.createSocket();
         socket.connect(basicBehaviorServerSocketAddress);
         assertTrue(doOneSocketFactoryTest(socket));
      }
      catch (Exception e)
      {
View Full Code Here

      }
     
     
      try
      {
         socket = socketFactory.createSocket(basicBehaviorServerHost, basicBehaviorServerPort);
         assertTrue(doOneSocketFactoryTest(socket));
      }
      catch (Exception e)
      {
         log.error(e);
View Full Code Here

        
         while (true)
         {
            try
            {
               socket = socketFactory.createSocket(basicBehaviorServerHost, basicBehaviorServerPort, inetAddress , localPort);
               break;
            }
            catch (BindException e)
            {
               log.info("unable to bind to: " + localPort);
View Full Code Here

      }
     
      try
      {
         InetAddress inetAddress = InetAddress.getByName(basicBehaviorServerHost);
         socket = socketFactory.createSocket(inetAddress, basicBehaviorServerPort);
         assertTrue(doOneSocketFactoryTest(socket));
      }
      catch (Exception e)
      {
         log.error(e);
View Full Code Here

            try
            {
               InetAddress remoteAddress = InetAddress.getByName(basicBehaviorServerHost);
               InetAddress localAddress = InetAddress.getByName("localhost");
               int localPort = random.nextInt() & 0xffff;
               socket = socketFactory.createSocket(remoteAddress, basicBehaviorServerPort, localAddress , localPort);
               assertTrue(socket.getLocalAddress().equals(localAddress));
               assertTrue(socket.getLocalPort() == localPort);
               assertTrue(doOneSocketFactoryTest(socket));
               break;
            }
View Full Code Here

        default:
            // Assumes cleartext for undefined values
            sf = SocketFactory.getDefault();
            break;
        }
        return sf.createSocket(server_, port_);
    }

}
View Full Code Here

        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);
View Full Code Here

            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

TOP
Copyright © 2018 www.massapi.com. 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.