Ignore test failures due to localhost bind exceptions, which should only
happen on systems where localhost access is blocked.
Change on 2017/08/22 by tball
@@ -23,6 +23,7 @@ import java.io.FileOutputStream;
import java.io.IOException;
import java.io.RandomAccessFile;
import java.io.UnsupportedEncodingException;
+import java.net.BindException;
import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.nio.BufferOverflowException;
@@ -2632,8 +2633,13 @@ public class FileChannelTest extends TestCase {
// connects two socketChannels.
socketChannelReceiver = SocketChannel.open();
serverSocketChannel = ServerSocketChannel.open();
+ try {
serverSocketChannel.socket().bind(
new InetSocketAddress(InetAddress.getLocalHost(), 0));
+ } catch (BindException e) {
+ // Continuous build environment doesn't support localhost sockets.
+ return;
+ }
socketChannelReceiver.socket().setSoTimeout(TIME_OUT);
socketChannelReceiver.connect(serverSocketChannel.socket()
.getLocalSocketAddress());
@@ -2940,8 +2946,13 @@ public class FileChannelTest extends TestCase {
socketChannelReceiver.socket().bind(
new InetSocketAddress(InetAddress.getLocalHost(), 0));
serverSocketChannel = ServerSocketChannel.open();
+ try {
serverSocketChannel.socket().bind(
new InetSocketAddress(InetAddress.getLocalHost(), 0));
+ } catch (BindException e) {
+ // Continuous build environment doesn't support localhost sockets.
+ return;
+ }
socketChannelReceiver.socket().setSoTimeout(TIME_OUT);
socketChannelReceiver.connect(serverSocketChannel.socket()
.getLocalSocketAddress());
