Skip to content

Commit

Permalink
8299487: Test java/net/httpclient/whitebox/SSLTubeTestDriver.java tim…
Browse files Browse the repository at this point in the history
…ed out

Reviewed-by: jpai
  • Loading branch information
dfuch committed Jun 12, 2024
1 parent 81ca0ec commit 81083a0
Showing 1 changed file with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 2024, 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
Expand Down Expand Up @@ -85,16 +85,17 @@ private static class SSLLoopbackSubscriber implements FlowTube {
ExecutorService exec,
CountDownLatch allBytesReceived) throws IOException {
SSLServerSocketFactory fac = ctx.getServerSocketFactory();
InetAddress loopback = InetAddress.getLoopbackAddress();
SSLServerSocket serv = (SSLServerSocket) fac.createServerSocket();
serv.setReuseAddress(false);
serv.bind(new InetSocketAddress(InetAddress.getLoopbackAddress(), 0));
serv.bind(new InetSocketAddress(loopback, 0));
SSLParameters params = serv.getSSLParameters();
params.setApplicationProtocols(new String[]{"proto2"});
serv.setSSLParameters(params);


int serverPort = serv.getLocalPort();
clientSock = new Socket("localhost", serverPort);
clientSock = new Socket(loopback, serverPort);
serverSock = (SSLSocket) serv.accept();
this.buffer = new LinkedBlockingQueue<>();
this.allBytesReceived = allBytesReceived;
Expand All @@ -107,6 +108,7 @@ private static class SSLLoopbackSubscriber implements FlowTube {
}

public void start() {
System.out.println("Starting: server listening at: " + serverSock.getLocalSocketAddress());
thread1.start();
thread2.start();
thread3.start();
Expand Down Expand Up @@ -144,6 +146,7 @@ private void clientReader() {
publisher.submit(List.of(bb));
}
} catch (Throwable e) {
System.out.println("clientReader got exception: " + e);
e.printStackTrace();
Utils.close(clientSock);
}
Expand Down Expand Up @@ -176,6 +179,7 @@ private void clientWriter() {
clientSubscription.request(1);
}
} catch (Throwable e) {
System.out.println("clientWriter got exception: " + e);
e.printStackTrace();
}
}
Expand Down Expand Up @@ -212,14 +216,18 @@ private void serverLoopback() {
is.close();
os.close();
serverSock.close();
System.out.println("serverLoopback exiting normally");
return;
}
os.write(bb, 0, n);
os.flush();
loopCount.addAndGet(n);
}
} catch (Throwable e) {
System.out.println("serverLoopback got exception: " + e);
e.printStackTrace();
} finally {
System.out.println("serverLoopback exiting at count: " + loopCount.get());
}
}

Expand Down

3 comments on commit 81083a0

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

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

@dfuch
Copy link
Member Author

@dfuch dfuch commented on 81083a0 Jun 14, 2024

Choose a reason for hiding this comment

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

/backport :jdk23

@openjdk
Copy link

@openjdk openjdk bot commented on 81083a0 Jun 14, 2024

Choose a reason for hiding this comment

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

@dfuch the backport was successfully created on the branch backport-dfuch-81083a0e-jdk23 in my personal fork of openjdk/jdk. To create a pull request with this backport targeting openjdk/jdk:jdk23, 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 81083a0e from the openjdk/jdk repository.

The commit being backported was authored by Daniel Fuchs on 12 Jun 2024 and was reviewed by Jaikiran Pai.

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/jdk:

$ git fetch https://github.com/openjdk-bots/jdk.git backport-dfuch-81083a0e-jdk23:backport-dfuch-81083a0e-jdk23
$ git checkout backport-dfuch-81083a0e-jdk23
# make changes
$ git add paths/to/changed/files
$ git commit --message 'Describe additional changes made'
$ git push https://github.com/openjdk-bots/jdk.git backport-dfuch-81083a0e-jdk23

⚠️ @dfuch You are not yet a collaborator in my fork openjdk-bots/jdk. An invite will be sent out and you need to accept it before you can proceed.

Please sign in to comment.