Fixed test assumption.
This commit is contained in:
parent
bb2872b789
commit
fd13361132
|
@ -18,7 +18,6 @@
|
|||
|
||||
package org.eclipse.jetty.client;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.Socket;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
@ -63,14 +62,7 @@ public class ExternalSiteTest
|
|||
int port = 80;
|
||||
|
||||
// Verify that we have connectivity
|
||||
try
|
||||
{
|
||||
new Socket(host, port).close();
|
||||
}
|
||||
catch (IOException x)
|
||||
{
|
||||
Assume.assumeNoException(x);
|
||||
}
|
||||
assumeCanConnectTo(host, port);
|
||||
|
||||
final CountDownLatch latch1 = new CountDownLatch(1);
|
||||
client.newRequest(host, port).send(new Response.CompleteListener()
|
||||
|
@ -110,14 +102,7 @@ public class ExternalSiteTest
|
|||
int port = 443;
|
||||
|
||||
// Verify that we have connectivity
|
||||
try
|
||||
{
|
||||
new Socket(host, port).close();
|
||||
}
|
||||
catch (IOException x)
|
||||
{
|
||||
Assume.assumeNoException(x);
|
||||
}
|
||||
assumeCanConnectTo(host, port);
|
||||
|
||||
final CountDownLatch latch = new CountDownLatch(1);
|
||||
client.newRequest(host, port).scheme("https").path("/nvp").send(new Response.CompleteListener()
|
||||
|
@ -139,14 +124,7 @@ public class ExternalSiteTest
|
|||
int port = 22; // SSH port
|
||||
|
||||
// Verify that we have connectivity
|
||||
try
|
||||
{
|
||||
new Socket(host, port).close();
|
||||
}
|
||||
catch (IOException x)
|
||||
{
|
||||
Assume.assumeNoException(x);
|
||||
}
|
||||
assumeCanConnectTo(host, port);
|
||||
|
||||
for (int i = 0; i < 2; ++i)
|
||||
{
|
||||
|
@ -186,14 +164,7 @@ public class ExternalSiteTest
|
|||
int port = 443;
|
||||
|
||||
// Verify that we have connectivity
|
||||
try
|
||||
{
|
||||
new Socket(host, port).close();
|
||||
}
|
||||
catch (IOException x)
|
||||
{
|
||||
Assume.assumeNoException(x);
|
||||
}
|
||||
assumeCanConnectTo(host, port);
|
||||
|
||||
ContentResponse response = client.newRequest(host, port)
|
||||
.scheme(HttpScheme.HTTPS.asString())
|
||||
|
@ -201,4 +172,16 @@ public class ExternalSiteTest
|
|||
.send();
|
||||
Assert.assertEquals(200, response.getStatus());
|
||||
}
|
||||
|
||||
protected void assumeCanConnectTo(String host, int port)
|
||||
{
|
||||
try
|
||||
{
|
||||
new Socket(host, port).close();
|
||||
}
|
||||
catch (Throwable x)
|
||||
{
|
||||
Assume.assumeNoException(x);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -386,7 +386,7 @@ public class ProxyTunnellingTest
|
|||
{
|
||||
new Socket(proxyHost, proxyPort).close();
|
||||
}
|
||||
catch (IOException x)
|
||||
catch (Throwable x)
|
||||
{
|
||||
Assume.assumeNoException(x);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue