Skip to content

Commit cd19d6f

Browse files
committed
test: fix broken test
1 parent 7d6e0fb commit cd19d6f

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

oncrpc4j-rpcgen/src/test/java/org/dcache/oncrpc4j/rpcgen/AbstractCalculatorTest.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package org.dcache.oncrpc4j.rpcgen;
22

3-
import java.net.InetSocketAddress;
43
import org.dcache.oncrpc4j.rpc.net.IpProtocolType;
54
import org.dcache.oncrpc4j.rpc.OncRpcProgram;
65
import org.dcache.oncrpc4j.rpc.OncRpcSvc;
@@ -15,7 +14,7 @@ public abstract class AbstractCalculatorTest {
1514
protected OncRpcSvc server;
1615
protected CalculatorClient client;
1716
protected String address = "127.0.0.1";
18-
protected int port = 0;
17+
volatile protected int port = 0;
1918

2019
@Before
2120
public void setup() throws Exception{
@@ -29,11 +28,11 @@ public void setup() throws Exception{
2928
server.register(new OncRpcProgram(Calculator.CALCULATOR, Calculator.CALCULATORVERS), serverImpl);
3029
server.start();
3130

32-
InetSocketAddress sockAddr = server.getInetSocketAddress(IpProtocolType.TCP);
31+
port = server.getInetSocketAddress(IpProtocolType.TCP).getPort();
3332

3433
client = new CalculatorClient(
3534
InetAddress.getByName(address),
36-
sockAddr.getPort(),
35+
port,
3736
Calculator.CALCULATOR,
3837
Calculator.CALCULATORVERS,
3938
IpProtocolType.TCP);

0 commit comments

Comments
 (0)