Skip to content

Commit

Permalink
8308336: Test java/net/HttpURLConnection/HttpURLConnectionExpectConti…
Browse files Browse the repository at this point in the history
…nueTest.java failed: java.net.BindException: Address already in use

Reviewed-by: dfuchs
  • Loading branch information
DarraghClarke authored and dfuch committed Jun 9, 2023
1 parent c052756 commit a48bcf3
Showing 1 changed file with 10 additions and 3 deletions.
Expand Up @@ -27,8 +27,11 @@
* @summary Verify that expect 100-continue doesn't hang
* @library /test/lib
* @run junit/othervm HttpURLConnectionExpectContinueTest
* @run junit/othervm -Djava.net.preferIPv4Stack=true HttpURLConnectionExpectContinueTest
* @run junit/othervm -Djava.net.preferIPv6Addresses=true HttpURLConnectionExpectContinueTest
*/

import jdk.test.lib.net.URIBuilder;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
Expand Down Expand Up @@ -73,7 +76,7 @@ public void startServerSocket() throws Exception {

control.serverSocket = new ServerSocket();
control.serverSocket.setReuseAddress(true);
control.serverSocket.bind(new InetSocketAddress("127.0.0.1", 54321));
control.serverSocket.bind(new InetSocketAddress(InetAddress.getLoopbackAddress(), 0));
Runnable runnable = () -> {
while (!control.stop) {
try {
Expand Down Expand Up @@ -419,8 +422,12 @@ public void testFixedLengthRequestWithDoubleExpect100ContinueResponse() throws E
}

// Creates a connection with all the common settings used in each test
private HttpURLConnection createConnection() throws IOException {
URL url = new URL("http://localhost:" + control.serverSocket.getLocalPort());
private HttpURLConnection createConnection() throws Exception {
URL url = URIBuilder.newBuilder()
.scheme("http")
.loopback()
.port(control.serverSocket.getLocalPort())
.toURL();

HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setDoOutput(true);
Expand Down

7 comments on commit a48bcf3

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@DarraghClarke
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/backport jdk21

@openjdk
Copy link

@openjdk openjdk bot commented on a48bcf3 Jun 19, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@DarraghClarke To use the /backport command, you need to be in the OpenJDK census and your GitHub account needs to be linked with your OpenJDK username (how to associate your GitHub account with your OpenJDK username).

@DarraghClarke
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/backport jdk21

@openjdk
Copy link

@openjdk openjdk bot commented on a48bcf3 Jun 20, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@DarraghClarke the backport was successfully created on the branch DarraghClarke-backport-a48bcf36 in my personal fork of openjdk/jdk21. To create a pull request with this backport targeting openjdk/jdk21:master, just click the following link:

➡️ Create pull request

The title of the pull request is automatically filled in correctly and below you find a suggestion for the pull request body:

Hi all,

This pull request contains a backport of commit a48bcf36 from the openjdk/jdk repository.

The commit being backported was authored by Darragh Clarke on 9 Jun 2023 and was reviewed by Daniel Fuchs.

Thanks!

If you need to update the source branch of the pull then run the following commands in a local clone of your personal fork of openjdk/jdk21:

$ git fetch https://github.com/openjdk-bots/jdk21.git DarraghClarke-backport-a48bcf36:DarraghClarke-backport-a48bcf36
$ git checkout DarraghClarke-backport-a48bcf36
# make changes
$ git add paths/to/changed/files
$ git commit --message 'Describe additional changes made'
$ git push https://github.com/openjdk-bots/jdk21.git DarraghClarke-backport-a48bcf36

@luchenlin
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/backport jdk11u-dev

@openjdk
Copy link

@openjdk openjdk bot commented on a48bcf3 Feb 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@luchenlin Could not automatically backport a48bcf36 to openjdk/jdk11u-dev due to conflicts in the following files:

  • test/jdk/java/net/HttpURLConnection/HttpURLConnectionExpectContinueTest.java

Please fetch the appropriate branch/commit and manually resolve these conflicts by using the following commands in your personal fork of openjdk/jdk11u-dev. Note: these commands are just some suggestions and you can use other equivalent commands you know.

# Fetch the up-to-date version of the target branch
$ git fetch --no-tags https://git.openjdk.org/jdk11u-dev.git master:master

# Check out the target branch and create your own branch to backport
$ git checkout master
$ git checkout -b backport-luchenlin-a48bcf36

# Fetch the commit you want to backport
$ git fetch --no-tags https://git.openjdk.org/jdk.git a48bcf367120fc7cde88b19097dabe9c86c90bb7

# Backport the commit
$ git cherry-pick --no-commit a48bcf367120fc7cde88b19097dabe9c86c90bb7
# Resolve conflicts now

# Commit the files you have modified
$ git add files/with/resolved/conflicts
$ git commit -m 'Backport a48bcf367120fc7cde88b19097dabe9c86c90bb7'

Once you have resolved the conflicts as explained above continue with creating a pull request towards the openjdk/jdk11u-dev with the title Backport a48bcf367120fc7cde88b19097dabe9c86c90bb7.

Below you can find a suggestion for the pull request body:

Hi all,

This pull request contains a backport of commit a48bcf36 from the openjdk/jdk repository.

The commit being backported was authored by Darragh Clarke on 9 Jun 2023 and was reviewed by Daniel Fuchs.

Thanks!

Please sign in to comment.