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

This code example shows how to use the following methods:getCause, getLocalizedMessage, getMessage
 
    /** 
     * @tests {@link java.nio.channels.UnresolvedAddressException#UnresolvedAddressException()} 
     */ 
    public void test_Constructor() { 
        UnresolvedAddressException e = new UnresolvedAddressException();
        assertNull(e.getMessage());
        assertNull(e.getLocalizedMessage());
        assertNull(e.getCause());
    } 
 
    /** 
     * @tests serialization/deserialization compatibility. 
     */ 
    @TestTargets({ 
        @TestTargetNew( 
            level = TestLevel.COMPLETE, 
            notes = "Verifies serialization/deserialization compatibility.", 
            method = "!SerializationSelf", 
            args = {} 
7
CodeRank
This code example shows how to use the following methods:getCause, getLocalizedMessage, getMessage
     
    /** 
     * @tests {@link java.nio.channels.UnresolvedAddressException#UnresolvedAddressException()} 
     */ 
    public void test_Constructor() { 
        UnresolvedAddressException e = new UnresolvedAddressException();
        assertNull(e.getMessage());
        assertNull(e.getLocalizedMessage());
        assertNull(e.getCause());
    } 
 
    /** 
     * @tests serialization/deserialization compatibility. 
     */ 
    public void testSerializationSelf() throws Exception {
 
        SerializationTest.verifySelf(new UnresolvedAddressException());
    } 
 
    /** 
6
CodeRank
This code example shows how to use the following methods:
        if (!(socketAddress instanceof InetSocketAddress)) {
            throw new UnsupportedAddressTypeException();
        } 
        InetSocketAddress inetSocketAddress = (InetSocketAddress) socketAddress;
        if (inetSocketAddress.isUnresolved()) {
            throw new UnresolvedAddressException();
        } 
        return inetSocketAddress;
    } 
 
    /* 
     * Get local address. 
     */ 
    public InetAddress getLocalAddress() throws UnknownHostException {
        if (!isBound) {
            byte[] any_bytes = { 0, 0, 0, 0 };
            return InetAddress.getByAddress(any_bytes);
        } 
        return localAddress;
    } 
4
CodeRank
This code example shows how to use the following methods:
        if (!(address instanceof InetSocketAddress)) {
            throw new IOException("InetSocketAddress expected");
        } 
        final InetSocketAddress sa = (InetSocketAddress) address;
        if (sa.isUnresolved()) {
            throw new UnresolvedAddressException();
        } 
        if (controlBlock == null) {
            bind(InetAddress.getLocalHost(), 0);
        } 
        controlBlock.appConnect(new IPv4Address(sa.getAddress()), sa.getPort());
    } 
 
    /** 
     * @see java.net.SocketImpl#connect(java.lang.String, int) 
     */ 
    protected final void connect(String host, int port) throws IOException {
        connect(InetAddress.getByName(host), port);
    } 
 
3
CodeRank
This code example shows how to use the following methods:
        if (!(socketAddress instanceof InetSocketAddress)) {
            throw new UnsupportedAddressTypeException();
        } 
        InetSocketAddress inetSocketAddress = (InetSocketAddress) socketAddress;
        if (inetSocketAddress.isUnresolved()) {
            throw new UnresolvedAddressException();
        } 
        return inetSocketAddress;
    } 
 
    /* 
     * Get local address. 
     */ 
    public InetAddress getLocalAddress() throws UnknownHostException {
        byte[] any_bytes = { 0, 0, 0, 0 };
        if (!isBound) {
            return InetAddress.getByAddress(any_bytes);
        } 
        return localAddress;
    } 
2
CodeRank

Related Java 8 UnresolvedAddressException Questions & Answers:

See Code Examples for Java 8 UnresolvedAddressException Methods: