< prev index next >
test/jdk/java/net/HttpURLConnection/SetAuthenticator/HTTPTestServer.java
Print this page
*** 1,7 ****
/*
! * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
--- 1,7 ----
/*
! * Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*** 206,216 ****
return instance.createInternal();
}
@Override
protected ServerSocket createBindable() throws IOException {
! return new ServerSocket(0, 0, InetAddress.getByName("127.0.0.1"));
}
@Override
protected SocketAddress getAddress(ServerSocket socket) {
return socket.getLocalSocketAddress();
--- 206,217 ----
return instance.createInternal();
}
@Override
protected ServerSocket createBindable() throws IOException {
! InetAddress address = InetAddress.getLoopbackAddress();
! return new ServerSocket(0, 0, address);
}
@Override
protected SocketAddress getAddress(ServerSocket socket) {
return socket.getLocalSocketAddress();
*** 228,238 ****
private static abstract class WebServerFactory<S extends HttpServer>
extends SocketBindableFactory<S> {
@Override
protected S createBindable() throws IOException {
S server = newHttpServer();
! server.bind(new InetSocketAddress("127.0.0.1", 0), 0);
return server;
}
@Override
protected SocketAddress getAddress(S server) {
--- 229,240 ----
private static abstract class WebServerFactory<S extends HttpServer>
extends SocketBindableFactory<S> {
@Override
protected S createBindable() throws IOException {
S server = newHttpServer();
! InetAddress address = InetAddress.getLoopbackAddress();
! server.bind(new InetSocketAddress(address, 0), 0);
return server;
}
@Override
protected SocketAddress getAddress(S server) {
< prev index next >