Java 8 BindException - 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 BindException class.

This code example shows how to use the following methods:
                                          final int destPort,
                                          final String localHost,
                                          final int localPort,
                                          final IOException exception) {
    if (exception instanceof BindException) {
      return new BindException(
          "Problem binding to [" 
              + localHost
              + ":" 
              + localPort
              + "] " 
              + exception
              + ";" 
              + see("BindException")); 
    } else if (exception instanceof ConnectException) {
      // connection refused; include the host:port in the error 
      return wrapWithMessage(exception, 
          "Call From " 
              + localHost
              + " to " 
5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getMessage
			// larry.gloo.net:3478 
			// stun.xten.net:3478 
			// stun.sipgate.net:10000 
			System.out.println(test.test());
		} catch (BindException be) {
			System.out.println(iaddress.toString() + ": " + be.getMessage());
		} catch (Exception e) {
			System.out.println(e.getMessage());
			e.printStackTrace();
		} 
	} 
 
} 
5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:
	 * @tests java.net.BindException#BindException() 
	 */ 
	public void test_Constructor() { 
		// Test for method java.net.BindException() 
		try { 
			throw new BindException();
		} catch (BindException e) {
			return; 
		} catch (Exception e) {
			fail("Exception during BindException test" + e.toString());
		} 
		fail("Failed to generate exception");
	} 
 
	/** 
	 * @tests java.net.BindException#BindException(java.lang.String) 
	 */ 
	public void test_ConstructorLjava_lang_String() { 
		// Test for method java.net.BindException(java.lang.String) 
		try { 
5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getMessage
                        serverSocket = factory.createSocket(port, backlog);
                    } else { 
                        serverSocket = factory.createSocket(port, backlog, inet);
                    } 
                } catch ( BindException be ) {
                    throw new BindException(be.getMessage() + ":" + port);
                } 
            } 
            if( serverTimeout >= 0 )
                serverSocket.setSoTimeout( serverTimeout );
        } catch( IOException ex ) {
            throw ex;
        } catch( InstantiationException ex1 ) {
            throw ex1;
        } 
        initialized = true;
    } 
     
    public void startEndpoint() throws IOException, InstantiationException { 
        if (!initialized) {
4
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getMessage
			// larry.gloo.net:3478 
			// stun.xten.net:3478 
			// stun.sipgate.net:10000 
			System.out.println(test.test());
		} catch (final BindException be) {
			System.out.println(iaddress.toString() + ": " + be.getMessage());
		} catch (final Exception e) {
			System.out.println(e.getMessage());
			e.printStackTrace();
		} 
	} 
} 
4
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getMessage
			// larry.gloo.net:3478 
			// stun.xten.net:3478 
			// stun.sipgate.net:10000 
			System.out.println(test.test());
		} catch (BindException be) {
			System.out.println(iaddress.toString() + ": " + be.getMessage());
		} catch (Exception e) {
			System.out.println(e.getMessage());
			e.printStackTrace();
		} 
	} 
 
} 
4
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:
	 * @tests java.net.BindException#BindException() 
	 */ 
	public void test_Constructor() { 
		// Test for method java.net.BindException() 
		try { 
			throw new BindException();
		} catch (BindException e) {
			return; 
		} catch (Exception e) {
			fail("Exception during BindException test" + e.toString());
		} 
		fail("Failed to generate exception");
	} 
 
	/** 
	 * @tests java.net.BindException#BindException(java.lang.String) 
	 */ 
	public void test_ConstructorLjava_lang_String() { 
		// Test for method java.net.BindException(java.lang.String) 
		try { 
4
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:
	 * @tests java.net.BindException#BindException(java.lang.String) 
	 */ 
	public void test_ConstructorLjava_lang_String() { 
		// Test for method java.net.BindException(java.lang.String) 
		try { 
			throw new BindException("Some error message");
		} catch (BindException e) {
			return; 
		} catch (Exception e) {
			fail("Exception during BindException test : " + e.getMessage());
		} 
		fail("Failed to generate exception");
	} 
 
	/** 
	 * Sets up the fixture, for example, open a network connection. This method 
	 * is called before a test is executed. 
	 */ 
	protected void setUp() { 
	} 
4
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:initCause
                    if (inet == null)
                        msg = orig.getMessage() + "<null>:" + port;
                    else 
                        msg = orig.getMessage() + " " +
                                inet.toString() + ":" + port;
                    BindException be = new BindException(msg);
                    be.initCause(orig);
                    throw be;
                } 
            } 
            if( serverTimeout >= 0 )
                serverSocket.setSoTimeout( serverTimeout );
        } catch( IOException ex ) {
            throw ex;
        } catch( InstantiationException ex1 ) {
            throw ex1;
        } 
        initialized = true;
    } 
     
4
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:
        // check that port is still available 
        int port = instance.getPort();
        HiddenServicePortInstance old = getHiddenServicePortInstance(port);
        if (old!=null && old.isOpen()) {
            // port is already occupied 
            throw new BindException("port="+port+" is already in use - instance="+instance+" cannot be bound to");
        } 
         
        // reserve the port 
        listenPortsOfThisHiddenService.put(port, instance);
        instance.setHiddenServiceInstance(this);
    } 
     
    /** 
     * Get the HiddenServicePortInstance of this HiddenServiceInstance and the specified port number. 
     * @param port 
     * @return null if nothing found 
     */ 
    public synchronized HiddenServicePortInstance getHiddenServicePortInstance(int port) {
        return listenPortsOfThisHiddenService.get(port);
4
CodeRank
Experience pair programming with AI  Get Codota for Java
See Code Examples for Java 8 BindException Methods: