Java 8 ConnectException - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 ConnectException class.

This code example shows how to use the following methods:
	@Test 
	public void shouldReportServerInTimeoutExceptionMessage() throws FileNotFoundException, OpenShiftException, IOException { 
		try { 
			// pre-conditions 
			mockDirector.mockGetAPI( 
					new HttpClientException(new ConnectException("java.net.ConnectException: Connection timed out"))); 
			// operation 
			new TestConnectionFactory().getConnection(clientMock); 
			// verification 
			fail("exception expected"); 
		} catch (OpenShiftEndpointException e) { 
			// verification 
			assertThat(e.getMessage()).contains("https://"); 
		} 
	} 
 
	@Test 
	public void shouldThrowWithTextAndExistCode() throws Throwable { 
			// pre-conditions 
		try { 
Full Snippet Info
6
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: getMessage
        20000); 
      socket.close();
      fail("Should not have connected"); 
    } catch (ConnectException ce) {
      System.err.println("Got exception: " + ce);
      assertTrue(ce.getMessage().contains("resulted in a loopback"));
    } catch (SocketException se) {
      // Some TCP stacks will actually throw their own Invalid argument exception 
      // here. This is also OK. 
      assertTrue(se.getMessage().contains("Invalid argument"));
    } 
  } 
   
  @Test 
  public void testSocketReadTimeoutWithChannel() throws Exception { 
    doSocketReadTimeoutTest(true); 
  } 
   
  @Test 
  public void testSocketReadTimeoutWithoutChannel() throws Exception { 
Full Snippet Info
6
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods:
     * http://cwiki.apache.org/confluence/display/MAVEN/ConnectException 
     * </p> 
     */ 
    public void testJdk7ipv6() 
    { 
        ConnectException connEx = new ConnectException( "Connection refused: connect" );
        IOException ioEx = new IOException( "Unable to establish loopback connection" );
        ioEx.initCause( connEx );
        MojoExecutionException mojoEx =
            new MojoExecutionException( "Error executing Jetty: Unable to establish loopback connection", ioEx );
 
        ExceptionHandler exceptionHandler = new DefaultExceptionHandler();
        ExceptionSummary exceptionSummary = exceptionHandler.handleException( mojoEx );
 
        String expectedReference = "http://cwiki.apache.org/confluence/display/MAVEN/ConnectException";
        assertEquals( expectedReference, exceptionSummary.getReference() );
 
    } 
} 
Full Snippet Info
5
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods:
    // daemon is down, so we'll treat it like connection refused. 
    if (socket.getLocalPort() == socket.getPort() &&
        socket.getLocalAddress().equals(socket.getInetAddress())) {
      LOG.info("Detected a loopback TCP socket, disconnecting it");
      socket.close();
      throw new ConnectException(
        "Localhost targeted connection resulted in a loopback. " + 
        "No daemon is listening on the target port."); 
    } 
  } 
   
  /**  
   * Given a string representation of a host, return its ip address 
   * in textual presentation. 
   *  
   * @param name a string representation of a host: 
   *             either a textual representation its IP address or its host name 
   * @return its IP address in the string format 
   */ 
  public static String normalizeHostName(String name) {
Full Snippet Info
5
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: getMessage
        try { 
 
            converter = new JodConverter();
 
        } catch (ConnectException e) {
            logger.error("Error creating JodConverter - " + e.getMessage(), e);
            throw new RODAServiceException("Error creating JodConverter - " 
                    + e.getMessage(), e);
        } 
    } 
 
    /** 
     * 
     * 
     * @throws ConverterException 
     * 
     * @see SynchronousConverter#convert(RepresentationObject) 
     */ 
    public ConversionResult convert(RepresentationObject representation)
            throws RepresentationAlreadyConvertedException, 
Full Snippet Info
5
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE

Related Java 8 ConnectException Questions & Answers: