Fixed test case failing on MS Vista
git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk@721833 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
f7d3372681
commit
e00ac08343
|
@ -476,7 +476,7 @@ public class TestRedirects extends ServerTestBase {
|
|||
|
||||
public void testRelativeRedirect() throws Exception {
|
||||
int port = this.localServer.getServicePort();
|
||||
String host = "localhost";
|
||||
String host = this.localServer.getServiceHostName();
|
||||
this.localServer.register("*", new RelativeRedirectService());
|
||||
|
||||
DefaultHttpClient client = new DefaultHttpClient();
|
||||
|
@ -505,7 +505,7 @@ public class TestRedirects extends ServerTestBase {
|
|||
|
||||
public void testRelativeRedirect2() throws Exception {
|
||||
int port = this.localServer.getServicePort();
|
||||
String host = "localhost";
|
||||
String host = this.localServer.getServiceHostName();
|
||||
this.localServer.register("*", new RelativeRedirectService2());
|
||||
|
||||
DefaultHttpClient client = new DefaultHttpClient();
|
||||
|
|
|
@ -290,6 +290,20 @@ public class LocalTestServer {
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Obtains the hostname of the server.
|
||||
*
|
||||
* @return the hostname
|
||||
*/
|
||||
public String getServiceHostName() {
|
||||
ServerSocket ssock = servicedSocket; // avoid synchronization
|
||||
if (ssock == null)
|
||||
throw new IllegalStateException("not running");
|
||||
|
||||
return ((InetSocketAddress) ssock.getLocalSocketAddress()).getHostName();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Obtains the local address the server is listening on
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue