Package java.net

Examples of java.net.Socket.connect()


         is.read();

         try
         {
            socket1.connect(address1, 200);
            fail();
         }
         catch (SocketTimeoutException e)
         {
            if (e.getMessage().equals("connect timed out"))
View Full Code Here


            catch (InterruptedException ignored) {}
         }
        
         try
         {
            socket1.connect(address1, 2000);
            fail();
         }
         catch (SocketException e)
         {
            if (e.getMessage().equals("Socket is closed"))
View Full Code Here

               fail();
            }
         }

         Socket socket2 = new VirtualSocket();
         socket2.connect(address1, 20000);

         socket1.close();
         socket2.close();

View Full Code Here

         try
         {
            log.info("connecting to: " + address2);
            log.info("shareable: " + MultiplexingManager.checkForShareableManager((InetSocketAddress)address2));
            socket3.connect(address2, 400);
            fail();
         }
         catch (SocketTimeoutException e)
         {
            if (e.getMessage().equals("connect timed out"))
View Full Code Here

               fail();
         }

         try
         {
            socket3.connect(address1, 200);
            fail();
         }
         catch (SocketException e)
         {
            if (e.getMessage().equals("Socket is closed"))
View Full Code Here

         timeout = getTimeout();
         if (timeout < 0)
            timeout = 0;
      }
     
      s.connect(inetAddr, timeout);

      return s;
   }

   protected SocketWrapper getPooledConnection()
View Full Code Here

   protected Socket createSocket(String address, int port, int timeout) throws IOException
   {
      Socket s = new Socket();
      s.setReuseAddress(getReuseAddress());
      InetSocketAddress inetAddr = new InetSocketAddress(address, port);
      s.connect(inetAddr);
      return s;
   }

   protected SocketWrapper getPooledConnection()
   {
View Full Code Here

         timeout = getTimeout();
         if (timeout < 0)
            timeout = 0;
      }
     
      s.connect(inetAddr, timeout);
     
      if (s instanceof SSLSocket)
      {
         // need to check for handshake listener and add them if there is one
         Object obj = configuration.get(Client.HANDSHAKE_COMPLETED_LISTENER);
View Full Code Here

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

    for (InetAddress mirror : mirrors) {
      try {
        s = new Socket();
        long lap = System.currentTimeMillis();
        s.connect(new InetSocketAddress(mirror, port), MAX_TIME);
        long time = System.currentTimeMillis() - lap;
        s.close();
        if(Out.isDebug(MirrorSelector.class))
          Out.debugAlways(MirrorSelector.class, "Connecting to " + mirror.getHostAddress() + " took " + time + "ms");
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.