Package com.davfx.ninio.common

Examples of com.davfx.ninio.common.Address


    Connectable init(String command);
    void connect(WaitingTelnetClientHandler clientHandler);
  }
 
  public Connectable get(String host) {
    return get(new Address(host, TelnetClient.DEFAULT_PORT));
  }
View Full Code Here


    public void received(HttpResponse response) {
      try {
        if (levelOfRedirect < maxRedirectLevels) {
          String location = response.getHeaders().get(Http.LOCATION);
          if (location != null) {
            Address newAddress = request.getAddress();
            String newPath;
            String l = null;
            boolean secure = false;
            int defaultPort = Http.DEFAULT_PORT;
            if (location.startsWith(Http.SECURE_PROTOCOL)) {
              l = location.substring(Http.SECURE_PROTOCOL.length());
              secure = true;
              defaultPort = Http.DEFAULT_SECURE_PORT;
            } else if (location.startsWith(Http.PROTOCOL)) {
              l = location.substring(Http.PROTOCOL.length());
            }
            if (l != null) {
              int i = l.indexOf(Http.PATH_SEPARATOR);
              if (i > 0) {
                newPath = l.substring(i);
                l = l.substring(0, i);
              } else {
                newPath = String.valueOf(Http.PATH_SEPARATOR);
              }
              int j = l.indexOf(Http.PORT_SEPARATOR);
              if (j < 0) {
                newAddress = new Address(l, defaultPort);
              } else {
                int newPort;
                String portValue = l.substring(j + 1);
                if (portValue.isEmpty()) {
                  newPort = defaultPort;
                } else {
                  try {
                    newPort = Integer.parseInt(portValue);
                  } catch (NumberFormatException e) {
                    throw new IOException("Bad location: " + location);
                  }
                }
                newAddress = new Address(l.substring(0, j), newPort);
              }
            } else {
              newPath = location;
            }
           
View Full Code Here

  public static interface Connectable {
    void connect(PingClientHandler clientHandler);
  }
 
  public Connectable get(String host) {
    return get(new Address(host, PingClient.DEFAULT_PORT));
   
  }
View Full Code Here

      q = queue;
      re = callWithEmptyExecutor;
      shouldCloseQueue = false;
    }

    final Address a;
    if (host != null) {
      if (port < 0) {
        a = new Address(host, address.getPort());
      } else {
        a = new Address(host, port);
      }
    } else {
      a = address;
    }
View Full Code Here

  public static ProxyUtils.ServerSideConfigurator server() {
    return new ProxyUtils.ServerSideConfigurator() {
      private final Map<Address, ProxyClient> clients = new HashMap<>();
      @Override
      public ReadyFactory configure(String connecterType, DataInputStream in) throws IOException {
        Address proxyAddress = new Address(in.readUTF(), in.readInt());
        ProxyClient c = clients.get(proxyAddress);
        if (c == null) {
          c = new ProxyClient(proxyAddress);
          clients.put(proxyAddress, c);
        }
View Full Code Here

    } else {
      q = queue;
      shouldCloseQueue = false;
    }

    final Address a;
    if (host != null) {
      if (port < 0) {
        a = new Address(host, address.getPort());
      } else {
        a = new Address(host, port);
      }
    } else {
      a = address;
    }
   
View Full Code Here

                          if (connection.second != null) {
                            connection.second.close();
                          }
                        }
                      } else if (len == 0) {
                        Address address = new Address(in.readUTF(), in.readInt());
                        ReadyFactory factory = proxyUtils.read(in);
                        Ready r = factory.create(queue, new OnceByteBufferAllocator());
                        MutablePair<Address, CloseableByteBufferHandler> connection = new MutablePair<Address, CloseableByteBufferHandler>(address, null);
                        connections.put(connectionId, connection);
                       
View Full Code Here

          try {
            port = (Integer.parseInt(ss.get(4)) * 256) + Integer.parseInt(ss.get(5));
          } catch (NumberFormatException e) {
            throw new IOException("Invalid address");
          }
          dataAddress = new Address(host, port);

          LOGGER.debug("Data address: {}", dataAddress);

          currentRawPath = toDownloadRawPaths.removeFirst();
          List<String> path = toDownloadSplitPaths.removeFirst();
View Full Code Here

      q = queue;
      re = repeatExecutor;
      shouldCloseQueue = false;
    }

    final Address a;
    if (host != null) {
      if (port < 0) {
        a = new Address(host, address.getPort());
      } else {
        a = new Address(host, port);
      }
    } else {
      a = address;
    }
   
View Full Code Here

TOP

Related Classes of com.davfx.ninio.common.Address

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.