code: public Socket createConnection(InetAddress peer) throws IOException
      {
          int attempts = 0;
          while (true)
          {
              try
              {
                  Socket socket = OutboundTcpConnectionPool.newSocket(peer);
                  socket.setSoTimeout(DatabaseDescriptor.getStreamingSocketTimeout());
                  socket.setKeepAlive(true);
                  return socket;
              }
              catch (IOException e)
              {
                  if (++attempts >= MAX_CONNECT_ATTEMPTS)
                      throw e;
  
                  long waitms = DatabaseDescriptor.getRpcTimeout() * (long)Math.pow(2, attempts);
                  logger.warn("Failed attempt " + attempts + " to connect to " + peer + ". Retrying in " + waitms + " ms. (" + e + ")");
                  try
                  {
                      Thread.sleep(waitms);
                  }
                  catch (InterruptedException wtf)
                  {
                      throw new IOException("interrupted", wtf);
                  }
              }
          }
      }
docs: Connect to peer and start exchanging message.
  When connect attempt fails, this retries for maximum of MAX_CONNECT_ATTEMPTS times.
  
  @param peer the peer to connect to.
  @return the created socket.
  
  @throws IOException when connection failed.