mirror of
https://github.com/apache/httpcomponents-client.git
synced 2025-02-19 16:37:06 +00:00
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 void testPostRedirect() throws Exception {
|
|||||||
|
|
||||||
public void testRelativeRedirect() throws Exception {
|
public void testRelativeRedirect() throws Exception {
|
||||||
int port = this.localServer.getServicePort();
|
int port = this.localServer.getServicePort();
|
||||||
String host = "localhost";
|
String host = this.localServer.getServiceHostName();
|
||||||
this.localServer.register("*", new RelativeRedirectService());
|
this.localServer.register("*", new RelativeRedirectService());
|
||||||
|
|
||||||
DefaultHttpClient client = new DefaultHttpClient();
|
DefaultHttpClient client = new DefaultHttpClient();
|
||||||
@ -505,7 +505,7 @@ public void testRelativeRedirect() throws Exception {
|
|||||||
|
|
||||||
public void testRelativeRedirect2() throws Exception {
|
public void testRelativeRedirect2() throws Exception {
|
||||||
int port = this.localServer.getServicePort();
|
int port = this.localServer.getServicePort();
|
||||||
String host = "localhost";
|
String host = this.localServer.getServiceHostName();
|
||||||
this.localServer.register("*", new RelativeRedirectService2());
|
this.localServer.register("*", new RelativeRedirectService2());
|
||||||
|
|
||||||
DefaultHttpClient client = new DefaultHttpClient();
|
DefaultHttpClient client = new DefaultHttpClient();
|
||||||
|
@ -290,6 +290,20 @@ public int getServicePort() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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
|
* Obtains the local address the server is listening on
|
||||||
*
|
*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user