Merged branch 'jetty-9.2.x' into 'master'.

This commit is contained in:
Simone Bordet 2015-01-09 12:59:17 +01:00
commit 86c2d01e80
2 changed files with 17 additions and 34 deletions

View File

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

View File

@ -386,7 +386,7 @@ public class ProxyTunnellingTest
{ {
new Socket(proxyHost, proxyPort).close(); new Socket(proxyHost, proxyPort).close();
} }
catch (IOException x) catch (Throwable x)
{ {
Assume.assumeNoException(x); Assume.assumeNoException(x);
} }