Package java.net

Examples of java.net.InetAddress$InetAddressHolder


    if (this.hostAddress != null) {
      return hostAddress;
    }
      try {
        //only cache inetaddresses if they represent the ip.
      InetAddress addr = InetAddress.getByName(this.hostName);
      if (addr.getHostAddress().equalsIgnoreCase(this.hostName)) {
        this.hostAddress = addr;
      }
      return addr;
    } catch (UnknownHostException e) {
      throw new TeiidRuntimeException("Failed to resolve the bind address"); //$NON-NLS-1$
View Full Code Here


   */
  public static Socket getSocket ( String host, int port, int delay)
    throws InterruptedIOException, IOException
  {
    // Convert host into an InetAddress, and call getSocket method
    InetAddress inetAddr = InetAddress.getByName (host);
   
    return getSocket ( inetAddr, port, delay );
  }
View Full Code Here

  protected DocAndConnection retrieveDocumentInternal(URL u, int method, String parameters,
         HttpConnection httpConn, String ntlmAuthorizationInfo)
    throws HttpException
  {
    String host = null;
    InetAddress addr = null;
    String path = null;
    String requestPath = null;
    String protocol = null;
    String userinfo = null;
    boolean chunkedEncoding = false;
View Full Code Here

      *  Get the name of the remote host
      *
      *  @return  remote host name
      */
     String getRemoteHostName() {
         InetAddress addr = controlSock.getInetAddress();
         return addr.getHostName();
     }
View Full Code Here

                try
                {
                    // use the next port in list (or 0 by default, indicating any port number)
                    FTPDataSocket socket = newActiveDataSocket(nextPort);
                    int port = socket.getLocalPort();
                    InetAddress addr = socket.getLocalAddress();
                    sendPORTCommand(addr, port);                 
                    return socket;
                }
                catch (SocketException ex)
                {
View Full Code Here

        msgContext.setProperty(MessageContext.TRANSPORT_HEADERS, headers);

        // find the remote party IP address and set it to the message context
        if (conn instanceof HttpInetConnection) {
            HttpInetConnection inetConn = (HttpInetConnection) conn;
            InetAddress remoteAddr = inetConn.getRemoteAddress();
            if (remoteAddr != null) {
                msgContext.setProperty(
                        MessageContext.REMOTE_ADDR, remoteAddr.getHostAddress());
                msgContext.setProperty(
                        NhttpConstants.REMOTE_HOST, NhttpUtil.getHostName(remoteAddr));
                remoteAddress = remoteAddr.getHostAddress();
            }
        }

        msgContext.setProperty(RequestResponseTransport.TRANSPORT_CONTROL,
                new HttpCoreRequestResponseTransport(msgContext));
View Full Code Here

        }
        msgContext.setProperty(NhttpConstants.REST_URL_POSTFIX, uri);
        String servicePrefix = oriUri.substring(0, oriUri.indexOf(uri));
        if (servicePrefix.indexOf("://") == -1) {
            HttpInetConnection inetConn = (HttpInetConnection) conn;
            InetAddress localAddr = inetConn.getLocalAddress();
            if (localAddr != null) {
                servicePrefix = (isHttps ? "https://" : "http://") +
                        localAddr.getHostName() + ":" + inetConn.getLocalPort() + servicePrefix;
            }
        }
        msgContext.setProperty(NhttpConstants.SERVICE_PREFIX, servicePrefix);

        if ("GET".equals(method)) {          
View Full Code Here

        ProtocolStack stack=ch.getProtocolStack();
        Protocol discovery=stack.removeProtocol("TCPPING");
        if(discovery != null){
            Protocol transport = stack.getTransport();
            MPING mping=new MPING();
            InetAddress bindAddress=Util.getBindAddress(new Properties());
            mping.setBindAddr(bindAddress);
            mping.setMulticastAddress("230.1.2.3");
            mping.setMcastPort(8888);           
            stack.insertProtocol(mping, ProtocolStack.ABOVE, transport.getName());
            mping.setProtocolStack(ch.getProtocolStack());
View Full Code Here

      }
    }
  }

  protected Socket createSocket(String hostname, int port) throws Exception {
    InetAddress addr = InetAddress.getByName(hostname);

    InetAddress outLocalAddr = null;
    String outLocalAddrStr = params.outLocalAddress;
    if (outLocalAddrStr != null)
      outLocalAddr = InetAddress.getByName(outLocalAddrStr);

    int outLocalPort = params.outLocalPort;
View Full Code Here

    public static void testEqualityWithDnsRoundRobin() throws UnknownHostException {
        IpAddress x1, x2, x3;

        StackType type=Util.getIpStackType();
        String tmp=type == StackType.IPv6? "::1" : "127.0.0.1";
        InetAddress addr=InetAddress.getByName(tmp);
        byte[] rawAddr=addr.getAddress();

        InetAddress inet1=InetAddress.getByAddress("MyHost1", rawAddr);
        InetAddress inet2=InetAddress.getByAddress("MyHost2", rawAddr);
        InetAddress inet3=InetAddress.getByAddress("MyHost3", rawAddr);
        Assert.assertEquals(inet1, inet2);

        x1=new IpAddress(inet1, 5555);
        x2=new IpAddress(inet2, 5555);
        x3=new IpAddress(inet3, 5555);
View Full Code Here

TOP

Related Classes of java.net.InetAddress$InetAddressHolder

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.