Package javax.net

Examples of javax.net.SocketFactory


      }
   }
  
   protected SocketFactory createSocketFactory(Map configuration)
   {
      SocketFactory sf = super.createSocketFactory(configuration);

      if (isCompleteSocketFactory(sf))
         return sf;
     
      SocketFactory wrapper = sf;

      try
      {
         SSLSocketBuilder server = new SSLSocketBuilder(configuration);
         sf = server.createSSLSocketFactory();
View Full Code Here


      }
   }

   protected SocketFactory createSocketFactory(Map configuration)
   {
      SocketFactory sf = super.createSocketFactory(configuration);

      if (isCompleteSocketFactory(sf))
         return sf;
     
      SocketFactory wrapper = sf;

      try
      {
         SSLSocketBuilder server = new SSLSocketBuilder(configuration);
         sf = server.createSSLSocketFactory();
View Full Code Here

   protected Socket createSocket(String address, int port, int timeout) throws IOException
   {
      if (isCallbackInvoker)
         return super.createSocket(address, port, timeout);
     
      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

/**
*
*/
   protected SocketFactory createSocketFactory(Map configuration)
   {
      SocketFactory sf = super.createSocketFactory(configuration);

      if (isCompleteSocketFactory(sf))
      {
         socketFactory = sf;
         return sf;
      }
     
      SocketFactory wrapper = sf;

      try
      {
         SSLSocketBuilder server = new SSLSocketBuilder(configuration);
         server.setUseSSLSocketFactory(false);
View Full Code Here

   }


   protected Socket createSocket(String address, int port, int timeout) throws IOException
   {
      SocketFactory sf = getSocketFactory();
      if (sf == null)
         createSocketFactory(configuration);

      VirtualSocket socket = new VirtualSocket(configuration);
      socket.connect(getConnectSocketAddress(), getBindSocketAddress(), this.timeout);
View Full Code Here

         return null;

      if (socketFactory != null)
         return socketFactory;

      SocketFactory factory = null;

      Object obj = configuration.get(Remoting.CUSTOM_SOCKET_FACTORY);
      if (obj != null)
      {
         if (obj instanceof SocketFactory)
View Full Code Here

      catch (IOException e1)
      {
         log.error(e1);
      }
     
      SocketFactory socketFactory = VirtualSocketFactory.getDefault();
      Socket socket = null;
     
      try
      {
         socket = socketFactory.createSocket();
         socket.connect(basicBehaviorServerSocketAddress);
         assertTrue(doOneSocketFactoryTest(socket));
      }
      catch (Exception e)
      {
         log.error(e);
         e.printStackTrace();
         fail();
      }
     
     
      try
      {
         socket = socketFactory.createSocket(basicBehaviorServerHost, basicBehaviorServerPort);
         assertTrue(doOneSocketFactoryTest(socket));
      }
      catch (Exception e)
      {
         log.error(e);
         e.printStackTrace();
         fail();
      }
     
      try
      {
         InetAddress inetAddress = InetAddress.getByName("localhost");
         int localPort = random.nextInt() & 0xffff;
        
         while (true)
         {
            try
            {
               socket = socketFactory.createSocket(basicBehaviorServerHost, basicBehaviorServerPort, inetAddress , localPort);
               break;
            }
            catch (BindException e)
            {
               log.info("unable to bind to: " + localPort);
               localPort = random.nextInt() & 0xffff;
            }
            catch (Exception e)
            {
               log.error(e);
               e.printStackTrace();
               fail();
            }
         }
        
         assertTrue(socket.getLocalAddress().equals(inetAddress));
         assertTrue(socket.getLocalPort() == localPort);
         assertTrue(doOneSocketFactoryTest(socket));
      }
      catch (Exception e)
      {
         log.error(e);
         e.printStackTrace();
         fail();
      }
     
      try
      {
         InetAddress inetAddress = InetAddress.getByName(basicBehaviorServerHost);
         socket = socketFactory.createSocket(inetAddress, basicBehaviorServerPort);
         assertTrue(doOneSocketFactoryTest(socket));
      }
      catch (Exception e)
      {
         log.error(e);
         e.printStackTrace();
         fail();
      }
     
     
      try
     
         while (true)
         {
            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

      if (conn instanceof HttpsURLConnection)
      {
         HttpsURLConnection sconn = (HttpsURLConnection) conn;

         SocketFactory socketFactory = getSocketFactory();
         if (socketFactory != null && socketFactory instanceof SSLSocketFactory)
         {
            SSLSocketFactory sslSocketFactory = getHandshakeCompatibleFactory((SSLSocketFactory) socketFactory, metadata);
            sconn.setSSLSocketFactory(sslSocketFactory);
         }
View Full Code Here

   }


   protected SocketFactory createSocketFactory(Map configuration)
   {
      SocketFactory sf = super.createSocketFactory(configuration);
     
      if (isCompleteSocketFactory(sf))
         return sf;
     
      SocketFactory wrapper = sf;

      try
      {
         SSLSocketBuilder server = new SSLSocketBuilder(configuration);
         server.setUseSSLSocketFactory(false);
View Full Code Here

      final Configuration conf =
        new HdfsConfiguration(datanode.getConf());
      final int socketTimeout = conf.getInt(
          DFSConfigKeys.DFS_CLIENT_SOCKET_TIMEOUT_KEY,
          HdfsServerConstants.READ_TIMEOUT);
      final SocketFactory socketFactory = NetUtils.getSocketFactory(conf,
          ClientProtocol.class);
     
      try {
        final DFSClient dfs = DatanodeJspHelper.getDFSClient(request,
            datanode, conf, getUGI(request, conf));
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.