Commit 94f5566e authored by Albert J. Wong's avatar Albert J. Wong

Revert "TestWebServer needs to use a free port."

Causing Android Build (dbg) findbugs to fail.

This reverts commit c4a3f88c.

BUG=none
TBR=hush

Review URL: https://codereview.chromium.org/514443002

Cr-Commit-Position: refs/heads/master@{#292025}
parent 5570dc0c
......@@ -62,6 +62,8 @@ import javax.net.ssl.X509TrustManager;
*/
public class TestWebServer {
private static final String TAG = "TestWebServer";
private static final int SERVER_PORT = 4444;
private static final int SSL_SERVER_PORT = 4445;
public static final String SHUTDOWN_PREFIX = "/shutdown";
......@@ -106,21 +108,19 @@ public class TestWebServer {
public TestWebServer(boolean ssl) throws Exception {
mSsl = ssl;
if (mSsl) {
mServerUri = "https:";
if (sSecureInstance != null) {
sSecureInstance.shutdown();
}
mServerUri = "https://localhost:" + SSL_SERVER_PORT;
} else {
mServerUri = "http:";
if (sInstance != null) {
sInstance.shutdown();
}
mServerUri = "http://localhost:" + SERVER_PORT;
}
setInstance(this, mSsl);
mServerThread = new ServerThread(this, mSsl);
mServerThread.start();
mServerUri += "//localhost:" + mServerThread.mSocket.getLocalPort();
}
/**
......@@ -552,9 +552,10 @@ public class TestWebServer {
if (mIsSsl) {
mSslContext = SSLContext.getInstance("TLS");
mSslContext.init(getKeyManagers(), null, null);
mSocket = mSslContext.getServerSocketFactory().createServerSocket(0);
mSocket = mSslContext.getServerSocketFactory().createServerSocket(
SSL_SERVER_PORT);
} else {
mSocket = new ServerSocket(0);
mSocket = new ServerSocket(SERVER_PORT);
}
return;
} catch (IOException e) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment