Package java.net

Examples of java.net.UnknownHostException


            failureDetector.recordException(node, 0, normalError);
        }
        assertAvailable(node);

        UnreachableStoreException catastrophicError = new UnreachableStoreException("intentionalerror",
                                                                                    new UnknownHostException("intentionalerror"));
        for(int i = 0; i < 10; i++) {
            failureDetector.recordException(node, 0, catastrophicError);
        }

        assertEquals(false, failureDetector.isAvailable(node));
View Full Code Here


        storeVerifier.addStore(node);
        for(int i = 0; i < 10; i++) {
            failureDetector.recordException(node,
                                            0,
                                            new UnreachableStoreException("intentionalerror",
                                                                          new UnknownHostException("intentionalerror")));
        }

        /**
         * Update the failure detector state with the new cluster
         */
 
View Full Code Here

    } finally {
      this.lock.unlock();
    }

    if (error) {
      throw new UnknownHostException(host);
    }
  }
View Full Code Here

        _flowProcess.increment(FetchCounters.DOMAINS_PROCESSING, 1);

        try {
            DomainInfo domainInfo = new DomainInfo(_protocolAndDomain);
            if (!domainInfo.isValidHostAddress()) {
                throw new UnknownHostException(_protocolAndDomain);
            }
           
            if (LOGGER.isTraceEnabled()) {
                LOGGER.trace(String.format("Resolved %s to %s", _protocolAndDomain, domainInfo.getHostAddress()));
            }
View Full Code Here

      throw bindException;
    } catch (SocketException e) {
      // If they try to bind to a different host's address, give a better
      // error message.
      if ("Unresolved address".equals(e.getMessage())) {
        throw new UnknownHostException("Invalid hostname for server: " +
                                       address.getHostName());
      } else {
        throw e;
      }
    }
View Full Code Here

    public Connection(ConnectionId remoteId) throws IOException {
      this.remoteId = remoteId;
      this.server = remoteId.getAddress();
      if (server.isUnresolved()) {
        throw new UnknownHostException("unknown host: " +
                                       remoteId.getAddress().getHostName());
      }
      this.maxIdleTime = remoteId.getMaxIdleTime();
      this.maxRetries = remoteId.getMaxRetries();
      this.tcpNoDelay = remoteId.getTcpNoDelay();
View Full Code Here

        InetSocketAddress address = this.address;
        if (address == null) {
            address = new InetSocketAddress(hostname, port);
        }
        if (address.getAddress() == null) {
            throw new UnknownHostException(address.getHostName());
        }

        this.socket = socketFactory.createSocket(address.getAddress(), address.getPort());
        this.writer = new BufferedWriter(new OutputStreamWriter(socket.getOutputStream(), charset));
    }
View Full Code Here

        InetSocketAddress address = this.address;
        if (address == null) {
            address = new InetSocketAddress(hostname, port);
        }
        if (address.getAddress() == null) {
            throw new UnknownHostException(address.getHostName());
        }

        this.socket = socketFactory.createSocket(address.getAddress(), address.getPort());
        this.writer = new BufferedWriter(new OutputStreamWriter(socket.getOutputStream(), charset));
    }
View Full Code Here

        verifyNoMoreInteractions(graphite);
    }

    @Test
    public void closesConnectionIfGraphiteIsUnavailable() throws Exception {
        doThrow(new UnknownHostException("UNKNOWN-HOST")).when(graphite).connect();
        reporter.report(map("gauge", gauge(1)),
            this.<Counter>map(),
            this.<Histogram>map(),
            this.<Meter>map(),
            this.<Timer>map());
View Full Code Here

    }.run();
  }

  @Test
  public void should_write_local_host_as_attribute_if_host_name_could_not_be_obtained() {
    final UnknownHostException e = new UnknownHostException();
    new EasyMockTemplate(timeStampFormatter, hostNameReader, targetNode) {
      @Override protected void expectations() throws Exception {
        expect(hostNameReader.localHostName()).andThrow(e);
        targetNode.addAttribute(name(HOSTNAME).value("localhost"));
        expectLastCall().once();
View Full Code Here

TOP

Related Classes of java.net.UnknownHostException

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.