File tree Expand file tree Collapse file tree
src/test/java/org/xbill/DNS Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -33,16 +33,18 @@ jobs:
3333 fetch-depth : 0
3434
3535 - name : Cache Maven dependencies
36- uses : actions/cache@v1
36+ uses : actions/cache@v2
3737 with :
38- path : ~/.m2
38+ path : ~/.m2/repository
3939 key : m2-cache-${{ matrix.java }}-${{ matrix.arch }}-${{ matrix.os }}
4040
4141 - name : Set up JDK ${{ matrix.java }}
42- uses : actions/setup-java@v1
42+ uses : actions/setup-java@v2
4343 with :
4444 java-version : ${{ matrix.java }}
4545 architecture : ${{ matrix.arch }}
46+ distribution : zulu
47+ check-latest : true
4648
4749 - name : Build with Maven
4850 if : " ${{ !(matrix.arch == 'x64' && matrix.os == 'ubuntu-20.04' && matrix.java == '11') || github.event.pull_request.head.repo.full_name != 'dnsjava/dnsjava' }}"
@@ -65,19 +67,20 @@ jobs:
6567 needs : test
6668 runs-on : ubuntu-20.04
6769 steps :
68- - uses : actions/checkout@v1
70+ - uses : actions/checkout@v2
6971
7072 - name : Cache Maven dependencies
71- uses : actions/cache@v1
73+ uses : actions/cache@v2
7274 with :
73- path : ~/.m2
75+ path : ~/.m2/repository
7476 key : m2-cache-8-x64-ubuntu-20.04
7577
7678 - name : Set up JDK 8
77- uses : joschi /setup-jdk@e87a7cec853d2dd7066adf837fe12bf0f3d45e52
79+ uses : actions /setup-java@v2
7880 with :
7981 java-version : ' 8'
8082 architecture : ' x64'
83+ distribution : zulu
8184 server-id : ossrh
8285 server-username : SONATYPE_USER
8386 server-password : SONATYPE_PW
Original file line number Diff line number Diff line change 2020public class NioTcpClientTest {
2121 @ Test
2222 void testResponseStream () throws InterruptedException , IOException {
23+ // start the selector thread early
24+ Client .selector ();
25+
2326 Record qr = Record .newRecord (Name .fromConstantString ("example.com." ), Type .A , DClass .IN );
2427 Message [] q = new Message [] {Message .newQuery (qr ), Message .newQuery (qr )};
28+ CountDownLatch cdlServerThreadStart = new CountDownLatch (1 );
2529 CountDownLatch cdl1 = new CountDownLatch (q .length );
2630 CountDownLatch cdl2 = new CountDownLatch (q .length );
2731 Message [] serverReceivedMessages = new Message [q .length ];
@@ -33,6 +37,7 @@ void testResponseStream() throws InterruptedException, IOException {
3337 new Thread (
3438 () -> {
3539 try {
40+ cdlServerThreadStart .countDown ();
3641 s [0 ] = ss .accept ();
3742 while (cdl1 .getCount () > 0 ) {
3843 int ii = i .getAndIncrement ();
@@ -56,6 +61,10 @@ void testResponseStream() throws InterruptedException, IOException {
5661 });
5762 server .start ();
5863
64+ if (!cdlServerThreadStart .await (5 , TimeUnit .SECONDS )) {
65+ fail ("timed out waiting for server thread to start" );
66+ }
67+
5968 for (int j = 0 ; j < q .length ; j ++) {
6069 int jj = j ;
6170 NioTcpClient .sendrecv (
You can’t perform that action at this time.
0 commit comments