java.nio.channels.UnsupportedAddressTypeException Java Examples
The following examples show how to use
java.nio.channels.UnsupportedAddressTypeException.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: NativeSocketAddress.java From Bytecoder with Apache License 2.0 | 6 votes |
/** * Encodes the given InetSocketAddress into this socket address. * @param protocolFamily protocol family * @param isa the InetSocketAddress to encode * @return the size of the socket address (sizeof sockaddr or sockaddr6) * @throws UnsupportedAddressTypeException if the address type is not supported */ int encode(ProtocolFamily protocolFamily, InetSocketAddress isa) { if (protocolFamily == StandardProtocolFamily.INET) { // struct sockaddr InetAddress ia = isa.getAddress(); if (!(ia instanceof Inet4Address)) throw new UnsupportedAddressTypeException(); putFamily(AF_INET); putAddress(AF_INET, ia); putPort(AF_INET, isa.getPort()); return SIZEOF_SOCKADDR4; } else { // struct sockaddr6 putFamily(AF_INET6); putAddress(AF_INET6, isa.getAddress()); putPort(AF_INET6, isa.getPort()); UNSAFE.putInt(address + OFFSET_SIN6_FLOWINFO, 0); return SIZEOF_SOCKADDR6; } }
Example #2
Source File: JdpBroadcaster.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
/** * Create a new broadcaster * * @param address - multicast group address * @param srcAddress - address of interface we should use to broadcast. * @param port - udp port to use * @param ttl - packet ttl * @throws IOException */ public JdpBroadcaster(InetAddress address, InetAddress srcAddress, int port, int ttl) throws IOException, JdpException { this.addr = address; this.port = port; ProtocolFamily family = (address instanceof Inet6Address) ? StandardProtocolFamily.INET6 : StandardProtocolFamily.INET; channel = DatagramChannel.open(family); channel.setOption(StandardSocketOptions.SO_REUSEADDR, true); channel.setOption(StandardSocketOptions.IP_MULTICAST_TTL, ttl); // with srcAddress equal to null, this constructor do exactly the same as // if srcAddress is not passed if (srcAddress != null) { // User requests particular interface to bind to NetworkInterface interf = NetworkInterface.getByInetAddress(srcAddress); try { channel.bind(new InetSocketAddress(srcAddress, 0)); } catch (UnsupportedAddressTypeException ex) { throw new JdpException("Unable to bind to source address"); } channel.setOption(StandardSocketOptions.IP_MULTICAST_IF, interf); } }
Example #3
Source File: JdpBroadcaster.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
/** * Create a new broadcaster * * @param address - multicast group address * @param srcAddress - address of interface we should use to broadcast. * @param port - udp port to use * @param ttl - packet ttl * @throws IOException */ public JdpBroadcaster(InetAddress address, InetAddress srcAddress, int port, int ttl) throws IOException, JdpException { this.addr = address; this.port = port; ProtocolFamily family = (address instanceof Inet6Address) ? StandardProtocolFamily.INET6 : StandardProtocolFamily.INET; channel = DatagramChannel.open(family); channel.setOption(StandardSocketOptions.SO_REUSEADDR, true); channel.setOption(StandardSocketOptions.IP_MULTICAST_TTL, ttl); // with srcAddress equal to null, this constructor do exactly the same as // if srcAddress is not passed if (srcAddress != null) { // User requests particular interface to bind to NetworkInterface interf = NetworkInterface.getByInetAddress(srcAddress); try { channel.bind(new InetSocketAddress(srcAddress, 0)); } catch (UnsupportedAddressTypeException ex) { throw new JdpException("Unable to bind to source address"); } channel.setOption(StandardSocketOptions.IP_MULTICAST_IF, interf); } }
Example #4
Source File: JdpBroadcaster.java From hottub with GNU General Public License v2.0 | 6 votes |
/** * Create a new broadcaster * * @param address - multicast group address * @param srcAddress - address of interface we should use to broadcast. * @param port - udp port to use * @param ttl - packet ttl * @throws IOException */ public JdpBroadcaster(InetAddress address, InetAddress srcAddress, int port, int ttl) throws IOException, JdpException { this.addr = address; this.port = port; ProtocolFamily family = (address instanceof Inet6Address) ? StandardProtocolFamily.INET6 : StandardProtocolFamily.INET; channel = DatagramChannel.open(family); channel.setOption(StandardSocketOptions.SO_REUSEADDR, true); channel.setOption(StandardSocketOptions.IP_MULTICAST_TTL, ttl); // with srcAddress equal to null, this constructor do exactly the same as // if srcAddress is not passed if (srcAddress != null) { // User requests particular interface to bind to NetworkInterface interf = NetworkInterface.getByInetAddress(srcAddress); try { channel.bind(new InetSocketAddress(srcAddress, 0)); } catch (UnsupportedAddressTypeException ex) { throw new JdpException("Unable to bind to source address"); } channel.setOption(StandardSocketOptions.IP_MULTICAST_IF, interf); } }
Example #5
Source File: JdpBroadcaster.java From jdk8u_jdk with GNU General Public License v2.0 | 6 votes |
/** * Create a new broadcaster * * @param address - multicast group address * @param srcAddress - address of interface we should use to broadcast. * @param port - udp port to use * @param ttl - packet ttl * @throws IOException */ public JdpBroadcaster(InetAddress address, InetAddress srcAddress, int port, int ttl) throws IOException, JdpException { this.addr = address; this.port = port; ProtocolFamily family = (address instanceof Inet6Address) ? StandardProtocolFamily.INET6 : StandardProtocolFamily.INET; channel = DatagramChannel.open(family); channel.setOption(StandardSocketOptions.SO_REUSEADDR, true); channel.setOption(StandardSocketOptions.IP_MULTICAST_TTL, ttl); // with srcAddress equal to null, this constructor do exactly the same as // if srcAddress is not passed if (srcAddress != null) { // User requests particular interface to bind to NetworkInterface interf = NetworkInterface.getByInetAddress(srcAddress); try { channel.bind(new InetSocketAddress(srcAddress, 0)); } catch (UnsupportedAddressTypeException ex) { throw new JdpException("Unable to bind to source address"); } channel.setOption(StandardSocketOptions.IP_MULTICAST_IF, interf); } }
Example #6
Source File: JdpBroadcaster.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
/** * Create a new broadcaster * * @param address - multicast group address * @param srcAddress - address of interface we should use to broadcast. * @param port - udp port to use * @param ttl - packet ttl * @throws IOException */ public JdpBroadcaster(InetAddress address, InetAddress srcAddress, int port, int ttl) throws IOException, JdpException { this.addr = address; this.port = port; ProtocolFamily family = (address instanceof Inet6Address) ? StandardProtocolFamily.INET6 : StandardProtocolFamily.INET; channel = DatagramChannel.open(family); channel.setOption(StandardSocketOptions.SO_REUSEADDR, true); channel.setOption(StandardSocketOptions.IP_MULTICAST_TTL, ttl); // with srcAddress equal to null, this constructor do exactly the same as // if srcAddress is not passed if (srcAddress != null) { // User requests particular interface to bind to NetworkInterface interf = NetworkInterface.getByInetAddress(srcAddress); try { channel.bind(new InetSocketAddress(srcAddress, 0)); } catch (UnsupportedAddressTypeException ex) { throw new JdpException("Unable to bind to source address"); } channel.setOption(StandardSocketOptions.IP_MULTICAST_IF, interf); } }
Example #7
Source File: JdpBroadcaster.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 6 votes |
/** * Create a new broadcaster * * @param address - multicast group address * @param srcAddress - address of interface we should use to broadcast. * @param port - udp port to use * @param ttl - packet ttl * @throws IOException */ public JdpBroadcaster(InetAddress address, InetAddress srcAddress, int port, int ttl) throws IOException, JdpException { this.addr = address; this.port = port; ProtocolFamily family = (address instanceof Inet6Address) ? StandardProtocolFamily.INET6 : StandardProtocolFamily.INET; channel = DatagramChannel.open(family); channel.setOption(StandardSocketOptions.SO_REUSEADDR, true); channel.setOption(StandardSocketOptions.IP_MULTICAST_TTL, ttl); // with srcAddress equal to null, this constructor do exactly the same as // if srcAddress is not passed if (srcAddress != null) { // User requests particular interface to bind to NetworkInterface interf = NetworkInterface.getByInetAddress(srcAddress); try { channel.bind(new InetSocketAddress(srcAddress, 0)); } catch (UnsupportedAddressTypeException ex) { throw new JdpException("Unable to bind to source address"); } channel.setOption(StandardSocketOptions.IP_MULTICAST_IF, interf); } }
Example #8
Source File: JdpBroadcaster.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
/** * Create a new broadcaster * * @param address - multicast group address * @param srcAddress - address of interface we should use to broadcast. * @param port - udp port to use * @param ttl - packet ttl * @throws IOException */ public JdpBroadcaster(InetAddress address, InetAddress srcAddress, int port, int ttl) throws IOException, JdpException { this.addr = address; this.port = port; ProtocolFamily family = (address instanceof Inet6Address) ? StandardProtocolFamily.INET6 : StandardProtocolFamily.INET; channel = DatagramChannel.open(family); channel.setOption(StandardSocketOptions.SO_REUSEADDR, true); channel.setOption(StandardSocketOptions.IP_MULTICAST_TTL, ttl); // with srcAddress equal to null, this constructor do exactly the same as // if srcAddress is not passed if (srcAddress != null) { // User requests particular interface to bind to NetworkInterface interf = NetworkInterface.getByInetAddress(srcAddress); try { channel.bind(new InetSocketAddress(srcAddress, 0)); } catch (UnsupportedAddressTypeException ex) { throw new JdpException("Unable to bind to source address"); } channel.setOption(StandardSocketOptions.IP_MULTICAST_IF, interf); } }
Example #9
Source File: DatagramChannelTest.java From j2objc with Apache License 2.0 | 6 votes |
/** * Test method for 'DatagramChannelImpl.connect(SocketAddress)' */ public void testConnect_UnsupportedType() throws IOException { assertFalse(this.channel1.isConnected()); class SubSocketAddress extends SocketAddress { private static final long serialVersionUID = 1L; public SubSocketAddress() { super(); } } SocketAddress newTypeAddress = new SubSocketAddress(); try { this.channel1.connect(newTypeAddress); fail("Should throw an UnsupportedAddressTypeException here."); } catch (UnsupportedAddressTypeException e) { // OK. } }
Example #10
Source File: SocketChannelTest.java From j2objc with Apache License 2.0 | 6 votes |
public void testCFII_UnsupportedType() throws Exception { class SubSocketAddress extends SocketAddress { private static final long serialVersionUID = 1L; //empty public SubSocketAddress() { super(); } } statusNotConnected_NotPending(); SocketAddress newTypeAddress = new SubSocketAddress(); try { this.channel1.connect(newTypeAddress); fail("Should throw an UnsupportedAddressTypeException here."); } catch (UnsupportedAddressTypeException e) { // OK. } }
Example #11
Source File: JdpBroadcaster.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
/** * Create a new broadcaster * * @param address - multicast group address * @param srcAddress - address of interface we should use to broadcast. * @param port - udp port to use * @param ttl - packet ttl * @throws IOException */ public JdpBroadcaster(InetAddress address, InetAddress srcAddress, int port, int ttl) throws IOException, JdpException { this.addr = address; this.port = port; ProtocolFamily family = (address instanceof Inet6Address) ? StandardProtocolFamily.INET6 : StandardProtocolFamily.INET; channel = DatagramChannel.open(family); channel.setOption(StandardSocketOptions.SO_REUSEADDR, true); channel.setOption(StandardSocketOptions.IP_MULTICAST_TTL, ttl); // with srcAddress equal to null, this constructor do exactly the same as // if srcAddress is not passed if (srcAddress != null) { // User requests particular interface to bind to NetworkInterface interf = NetworkInterface.getByInetAddress(srcAddress); try { channel.bind(new InetSocketAddress(srcAddress, 0)); } catch (UnsupportedAddressTypeException ex) { throw new JdpException("Unable to bind to source address"); } channel.setOption(StandardSocketOptions.IP_MULTICAST_IF, interf); } }
Example #12
Source File: JdpBroadcaster.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
/** * Create a new broadcaster * * @param address - multicast group address * @param srcAddress - address of interface we should use to broadcast. * @param port - udp port to use * @param ttl - packet ttl * @throws IOException */ public JdpBroadcaster(InetAddress address, InetAddress srcAddress, int port, int ttl) throws IOException, JdpException { this.addr = address; this.port = port; ProtocolFamily family = (address instanceof Inet6Address) ? StandardProtocolFamily.INET6 : StandardProtocolFamily.INET; channel = DatagramChannel.open(family); channel.setOption(StandardSocketOptions.SO_REUSEADDR, true); channel.setOption(StandardSocketOptions.IP_MULTICAST_TTL, ttl); // with srcAddress equal to null, this constructor do exactly the same as // if srcAddress is not passed if (srcAddress != null) { // User requests particular interface to bind to NetworkInterface interf = NetworkInterface.getByInetAddress(srcAddress); try { channel.bind(new InetSocketAddress(srcAddress, 0)); } catch (UnsupportedAddressTypeException ex) { throw new JdpException("Unable to bind to source address"); } channel.setOption(StandardSocketOptions.IP_MULTICAST_IF, interf); } }
Example #13
Source File: JdpBroadcaster.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
/** * Create a new broadcaster * * @param address - multicast group address * @param srcAddress - address of interface we should use to broadcast. * @param port - udp port to use * @param ttl - packet ttl * @throws IOException */ public JdpBroadcaster(InetAddress address, InetAddress srcAddress, int port, int ttl) throws IOException, JdpException { this.addr = address; this.port = port; ProtocolFamily family = (address instanceof Inet6Address) ? StandardProtocolFamily.INET6 : StandardProtocolFamily.INET; channel = DatagramChannel.open(family); channel.setOption(StandardSocketOptions.SO_REUSEADDR, true); channel.setOption(StandardSocketOptions.IP_MULTICAST_TTL, ttl); // with srcAddress equal to null, this constructor do exactly the same as // if srcAddress is not passed if (srcAddress != null) { // User requests particular interface to bind to NetworkInterface interf = NetworkInterface.getByInetAddress(srcAddress); try { channel.bind(new InetSocketAddress(srcAddress, 0)); } catch (UnsupportedAddressTypeException ex) { throw new JdpException("Unable to bind to source address"); } channel.setOption(StandardSocketOptions.IP_MULTICAST_IF, interf); } }
Example #14
Source File: JdpBroadcaster.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
/** * Create a new broadcaster * * @param address - multicast group address * @param srcAddress - address of interface we should use to broadcast. * @param port - udp port to use * @param ttl - packet ttl * @throws IOException */ public JdpBroadcaster(InetAddress address, InetAddress srcAddress, int port, int ttl) throws IOException, JdpException { this.addr = address; this.port = port; ProtocolFamily family = (address instanceof Inet6Address) ? StandardProtocolFamily.INET6 : StandardProtocolFamily.INET; channel = DatagramChannel.open(family); channel.setOption(StandardSocketOptions.SO_REUSEADDR, true); channel.setOption(StandardSocketOptions.IP_MULTICAST_TTL, ttl); // with srcAddress equal to null, this constructor do exactly the same as // if srcAddress is not passed if (srcAddress != null) { // User requests particular interface to bind to NetworkInterface interf = NetworkInterface.getByInetAddress(srcAddress); try { channel.bind(new InetSocketAddress(srcAddress, 0)); } catch (UnsupportedAddressTypeException ex) { throw new JdpException("Unable to bind to source address"); } channel.setOption(StandardSocketOptions.IP_MULTICAST_IF, interf); } }
Example #15
Source File: JdpBroadcaster.java From dragonwell8_jdk with GNU General Public License v2.0 | 6 votes |
/** * Create a new broadcaster * * @param address - multicast group address * @param srcAddress - address of interface we should use to broadcast. * @param port - udp port to use * @param ttl - packet ttl * @throws IOException */ public JdpBroadcaster(InetAddress address, InetAddress srcAddress, int port, int ttl) throws IOException, JdpException { this.addr = address; this.port = port; ProtocolFamily family = (address instanceof Inet6Address) ? StandardProtocolFamily.INET6 : StandardProtocolFamily.INET; channel = DatagramChannel.open(family); channel.setOption(StandardSocketOptions.SO_REUSEADDR, true); channel.setOption(StandardSocketOptions.IP_MULTICAST_TTL, ttl); // with srcAddress equal to null, this constructor do exactly the same as // if srcAddress is not passed if (srcAddress != null) { // User requests particular interface to bind to NetworkInterface interf = NetworkInterface.getByInetAddress(srcAddress); try { channel.bind(new InetSocketAddress(srcAddress, 0)); } catch (UnsupportedAddressTypeException ex) { throw new JdpException("Unable to bind to source address"); } channel.setOption(StandardSocketOptions.IP_MULTICAST_IF, interf); } }
Example #16
Source File: AbstractAddressResolver.java From netty-4.1.22 with Apache License 2.0 | 5 votes |
@Override public final boolean isResolved(SocketAddress address) { if (!isSupported(address)) { throw new UnsupportedAddressTypeException(); } @SuppressWarnings("unchecked") final T castAddress = (T) address; return doIsResolved(castAddress); }
Example #17
Source File: TCPMemcachedNodeImpl.java From kylin with Apache License 2.0 | 5 votes |
public final SocketAddress getSocketAddress() { if (!(socketAddress instanceof InetSocketAddress)) { throw new UnsupportedAddressTypeException(); } InetSocketAddress inetSocketAddress = (InetSocketAddress) socketAddress; return new InetSocketAddress(inetSocketAddress.getHostName(), inetSocketAddress.getPort()); }
Example #18
Source File: UnsupportedAddressTypeExceptionTest.java From j2objc with Apache License 2.0 | 5 votes |
/** * @tests {@link java.nio.channels.UnsupportedAddressTypeException#UnsupportedAddressTypeException()} */ public void test_Constructor() { UnsupportedAddressTypeException e = new UnsupportedAddressTypeException(); assertNull(e.getMessage()); assertNull(e.getLocalizedMessage()); assertNull(e.getCause()); }
Example #19
Source File: NetworkAdmin.java From TorrentEngine with GNU General Public License v3.0 | 5 votes |
public InetAddress getSingleHomedServiceBindAddress(int proto) { InetAddress[] addrs = currentBindIPs; if(proto == IP_PROTOCOL_VERSION_AUTO){ return addrs[0]; }else{ for( InetAddress addr: addrs ){ if( (proto == IP_PROTOCOL_VERSION_REQUIRE_V4 && addr instanceof Inet4Address || addr.isAnyLocalAddress()) || (proto == IP_PROTOCOL_VERSION_REQUIRE_V6 && addr instanceof Inet6Address) ){ if ( addr.isAnyLocalAddress()){ if ( proto == IP_PROTOCOL_VERSION_REQUIRE_V4 ){ return( anyLocalAddressIPv4 ); }else{ return( anyLocalAddressIPv6 ); } }else{ return( addr ); } } } } throw new UnsupportedAddressTypeException(); }
Example #20
Source File: JdpBroadcaster.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** * Create a new broadcaster * * @param address - multicast group address * @param srcAddress - address of interface we should use to broadcast. * @param port - udp port to use * @param ttl - packet ttl * @throws IOException */ public JdpBroadcaster(InetAddress address, InetAddress srcAddress, int port, int ttl) throws IOException, JdpException { this.addr = address; this.port = port; ProtocolFamily family = (address instanceof Inet6Address) ? StandardProtocolFamily.INET6 : StandardProtocolFamily.INET; channel = DatagramChannel.open(family); channel.setOption(StandardSocketOptions.SO_REUSEADDR, true); channel.setOption(StandardSocketOptions.IP_MULTICAST_TTL, ttl); // with srcAddress equal to null, this constructor do exactly the same as // if srcAddress is not passed if (srcAddress != null) { // User requests particular interface to bind to NetworkInterface interf = NetworkInterface.getByInetAddress(srcAddress); if (interf == null) { throw new JdpException("Unable to get network interface for " + srcAddress.toString()); } if (!interf.isUp()) { throw new JdpException(interf.getName() + " is not up."); } if (!interf.supportsMulticast()) { throw new JdpException(interf.getName() + " does not support multicast."); } try { channel.bind(new InetSocketAddress(srcAddress, 0)); } catch (UnsupportedAddressTypeException ex) { throw new JdpException("Unable to bind to source address"); } channel.setOption(StandardSocketOptions.IP_MULTICAST_IF, interf); } }
Example #21
Source File: Net.java From Bytecoder with Apache License 2.0 | 5 votes |
static InetSocketAddress checkAddress(SocketAddress sa, ProtocolFamily family) { InetSocketAddress isa = checkAddress(sa); if (family == StandardProtocolFamily.INET) { InetAddress addr = isa.getAddress(); if (!(addr instanceof Inet4Address)) throw new UnsupportedAddressTypeException(); } return isa; }
Example #22
Source File: Net.java From Bytecoder with Apache License 2.0 | 5 votes |
public static InetSocketAddress checkAddress(SocketAddress sa) { if (sa == null) throw new NullPointerException(); if (!(sa instanceof InetSocketAddress)) throw new UnsupportedAddressTypeException(); // ## needs arg InetSocketAddress isa = (InetSocketAddress)sa; if (isa.isUnresolved()) throw new UnresolvedAddressException(); // ## needs arg InetAddress addr = isa.getAddress(); if (!(addr instanceof Inet4Address || addr instanceof Inet6Address)) throw new IllegalArgumentException("Invalid address type"); return isa; }
Example #23
Source File: PRUDPPacketHandlerImpl.java From TorrentEngine with GNU General Public License v3.0 | 4 votes |
protected void calcBind() { if ( explicit_bind_ip != null ){ if(altProtocolDelegate != null) { altProtocolDelegate.destroy(); altProtocolDelegate = null; } target_bind_ip = explicit_bind_ip; }else{ InetAddress altAddress = null; NetworkAdmin adm = NetworkAdmin.getSingleton(); try { if (default_bind_ip instanceof Inet6Address && !default_bind_ip.isAnyLocalAddress() && adm.hasIPV4Potential()) altAddress = adm.getSingleHomedServiceBindAddress(NetworkAdmin.IP_PROTOCOL_VERSION_REQUIRE_V4); else if (default_bind_ip instanceof Inet4Address && adm.hasIPV6Potential()) altAddress = adm.getSingleHomedServiceBindAddress(NetworkAdmin.IP_PROTOCOL_VERSION_REQUIRE_V6); } catch (UnsupportedAddressTypeException e) { } if(altProtocolDelegate != null && !altProtocolDelegate.explicit_bind_ip.equals(altAddress)) { altProtocolDelegate.destroy(); altProtocolDelegate = null; } if(altAddress != null && altProtocolDelegate == null) { altProtocolDelegate = new PRUDPPacketHandlerImpl(port,altAddress,packet_transformer); altProtocolDelegate.stats = stats; altProtocolDelegate.primordial_handlers = primordial_handlers; altProtocolDelegate.request_handler = request_handler; } target_bind_ip = default_bind_ip; } }
Example #24
Source File: NetworkAdminImpl.java From BiglyBT with GNU General Public License v2.0 | 4 votes |
@Override public InetAddress getSingleHomedServiceBindAddress(int proto) { InetAddress[] addrs = currentBindIPs; if ( proto == IP_PROTOCOL_VERSION_AUTO ){ // don't try and do anything smart here regarding converting an 'any local address' into either // anyLocalAddressIPv4 or anyLocalAddressIPv6 depending on preferv6 or supportsV6 because this stuffs // up other code in PRUDPPacketHandlerImpl creating 'alt-protocol-delegates' Don't ask me... return( addrs[0] ); }else{ for( InetAddress addr: addrs ){ if( (proto == IP_PROTOCOL_VERSION_REQUIRE_V4 && addr instanceof Inet4Address || addr.isAnyLocalAddress()) || (proto == IP_PROTOCOL_VERSION_REQUIRE_V6 && addr instanceof Inet6Address) ){ if ( addr.isAnyLocalAddress()){ if ( proto == IP_PROTOCOL_VERSION_REQUIRE_V4 ){ return( anyLocalAddressIPv4 ); }else{ return( anyLocalAddressIPv6 ); } }else{ return( addr ); } } } } throw( new UnsupportedAddressTypeException(){ public String getMessage() { return( "No bind address for " + (proto == IP_PROTOCOL_VERSION_REQUIRE_V4?"IPv4":"IPv6" )); } }); }
Example #25
Source File: AbstractXmlHighlightingFragment2.java From sarl with Apache License 2.0 | 4 votes |
@Override public void appendHeader() { throw new UnsupportedAddressTypeException(); }
Example #26
Source File: Net.java From Bytecoder with Apache License 2.0 | 4 votes |
static InetSocketAddress asInetSocketAddress(SocketAddress sa) { if (!(sa instanceof InetSocketAddress)) throw new UnsupportedAddressTypeException(); return (InetSocketAddress)sa; }
Example #27
Source File: UnsupportedAddressTypeExceptionTest.java From j2objc with Apache License 2.0 | 4 votes |
/** * @tests serialization/deserialization compatibility. */ public void testSerializationSelf() throws Exception { SerializationTest.verifySelf(new UnsupportedAddressTypeException()); }
Example #28
Source File: UnsupportedAddressTypeExceptionTest.java From j2objc with Apache License 2.0 | 4 votes |
/** * @tests serialization/deserialization compatibility with RI. */ public void testSerializationCompatibility() throws Exception { SerializationTest.verifyGolden(this, new UnsupportedAddressTypeException()); }
Example #29
Source File: NetworkAdmin.java From BiglyBT with GNU General Public License v2.0 | 2 votes |
/** * Selects a bind address based on available host address and bind protocol families * * @param host * @return Array with 2 entries, first is selected host address, second is selected bind address (possibly null of course) */ public abstract InetAddress[] getSingleHomedServiceBinding( String host ) throws UnknownHostException, UnsupportedAddressTypeException;
Example #30
Source File: NetworkAdmin.java From BiglyBT with GNU General Public License v2.0 | 2 votes |
/** * @throws UnsupportedAddressTypeException when no address matching the v4/v6 requirements is found, always returns an address when auto is selected */ public abstract InetAddress getSingleHomedServiceBindAddress(int protocolVersion) throws UnsupportedAddressTypeException;