Fix compile error when compiling on OS X

This commit is contained in:
Matty Southall 2013-09-19 20:59:50 +01:00 committed by md_5
parent a7a32509c7
commit f12dcc72d9

View File

@ -12,7 +12,13 @@ public class ThrottleTest
public void testThrottle() throws InterruptedException, UnknownHostException
{
ConnectionThrottle throttle = new ConnectionThrottle( 5 );
InetAddress address = InetAddress.getLocalHost();
InetAddress address;
try {
address = InetAddress.getLocalHost();
} catch (UnknownHostException ex) {
address = InetAddress.getByName( null );
}
Assert.assertFalse( "Address should not be throttled", throttle.throttle( address ) );
Assert.assertTrue( "Address should be throttled", throttle.throttle( address ) );