Package com.google.common.net

Examples of com.google.common.net.HostAndPort


      if (vm.getPassword() != null && loginCredentials.getOptionalPassword() == null)
         loginCredentials = loginCredentials.toBuilder().password(vm.getPassword()).build();
      assert HostSpecifier.isValid(vm.getIPAddress());
      if (!InetAddresses2.isPrivateIPAddress(vm.getIPAddress())) {
         // not sure if the network is public or not, so we have to test
         HostAndPort socket = HostAndPort.fromParts(vm.getIPAddress(), 22);
         System.err.printf("testing socket %s%n", socket);
         System.err.printf("testing ssh %s%n", socket);
         checkSSH(socket);
      } else {
         System.err.printf("skipping ssh %s, as private%n", vm.getIPAddress());
View Full Code Here


      Stopwatch watch = new Stopwatch().start();
      ExecResponse exec = client.runScriptOnNode(node.getId(), process, runAsRoot(false).wrapInInitScript(false));
      stats.backgroundProcessMilliseconds = watch.elapsedTime(TimeUnit.MILLISECONDS);
      watch.reset().start();
     
      HostAndPort socket = null;
      try {
         socket = openSocketFinder.findOpenSocketOnNode(node, 8080, 600, TimeUnit.SECONDS);
      } catch (NoSuchElementException e) {
         throw new NoSuchElementException(format("%s%n%s%s", e.getMessage(), exec.getOutput(), exec.getError()));
      }
View Full Code Here

      Map<String, Credentials> credsMap = api.getServerServices().getServerCredentialsList();
      LoginCredentials instanceCredentials = LoginCredentials.fromCredentials(credsMap.get(createdServer.getName()));
      assertNotNull(instanceCredentials);

      HostAndPort socket = HostAndPort.fromParts(createdServer.getIp().getIp(), 22);
      SocketOpen socketOpen = Guice.createInjector().getInstance(SocketOpen.class);
      Predicate<HostAndPort> socketTester = retry(socketOpen, 180, 5, SECONDS);
      socketTester.apply(socket);

      // check that the get credentials call is the same as this
View Full Code Here

            find(vApp.getResourceAllocations(), CIMPredicates.resourceTypeIn(ResourceType.DISK_DRIVE))
                  .getVirtualQuantity().longValue());
   }

   protected void doCheckPass(String address) throws IOException {
      HostAndPort socket = HostAndPort.fromParts(address, 22);

      System.out.printf("%d: %s awaiting ssh service to start%n", System.currentTimeMillis(), socket);
      assert socketTester.apply(socket);
      System.out.printf("%d: %s ssh service started%n", System.currentTimeMillis(), socket);
View Full Code Here

      assertEquals(rule.getIPAddressId(), ip.getId());
      assertEquals(rule.getVirtualMachineId(), vm.getId());
      assertEquals(rule.getStartPort(), 22);
      assertEquals(rule.getProtocol(), "tcp");
      checkRule(rule);
      HostAndPort socket = HostAndPort.fromParts(ip.getIPAddress(), 22);
      checkSSH(socket);
   }
View Full Code Here

      String address = rule != null ? rule.getIPAddress() : vm.getNode().getIPAddress();

      loginCredentials = prioritizeCredentialsFromTemplate.apply(template, vm.getCredentials());

      assert InetAddresses.isInetAddress(address) : vm;
      HostAndPort socket = HostAndPort.fromParts(address, 22);
      checkSSH(socket);
   }
View Full Code Here

   
    String monitorKey = "Active Accumulo Monitor: ";
    String monitorAddr = getInfoAvoidingNull(clusterDesc, AccumuloKeys.MONITOR_ADDRESS);
    if (!StringUtils.isBlank(monitorAddr)) {
      try {
        HostAndPort hostPort = HostAndPort.fromString(monitorAddr);
        details.put(monitorKey,
            String.format("http://%s:%d", hostPort.getHostText(), hostPort.getPort()));
      } catch (Exception e) {
        details.put(monitorKey + "N/A", null);
      }
    } else {
      details.put(monitorKey + "N/A", null);
View Full Code Here

    }

    private ListenableFuture<? extends ClientInterface> createClient(ThriftClientManager clientManager)
            throws TTransportException, InterruptedException, ExecutionException
    {
        HostAndPort address = HostAndPort.fromParts("localhost", server.getPort());
        return clientManager.createClient(new FramedClientConnector(address), clientClass);
    }
View Full Code Here

    }

    protected <T> ListenableFuture<T> createClient(Class<T> clientClass, int serverPort, final Duration connectDelay)
            throws TTransportException, InterruptedException, ExecutionException
    {
        HostAndPort address = HostAndPort.fromParts("localhost", serverPort);
        ThriftClientConfig config = new ThriftClientConfig().setConnectTimeout(new Duration(1, TimeUnit.SECONDS))
                                                            .setReadTimeout(new Duration(1, TimeUnit.SECONDS))
                                                            .setWriteTimeout(new Duration(1, TimeUnit.SECONDS));
        FramedClientConnector connector = new FramedClientConnector(address) {
            @Override
View Full Code Here

        s = s.toLowerCase();
        if (s.startsWith("http://") || s.startsWith("https://")) {
            return URI.create(s);
        }

        HostAndPort host = HostAndPort.fromString(s);
        try {
            return new URI("http", null, host.getHostText(), host.getPortOrDefault(80), null, null, null);
        }
        catch (URISyntaxException e) {
            throw new IllegalArgumentException(e);
        }
    }
View Full Code Here

TOP

Related Classes of com.google.common.net.HostAndPort

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.