File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed
oncrpc4j-rpcgen/src/test/java/org/dcache/oncrpc4j/rpcgen Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change 1
1
package org .dcache .oncrpc4j .rpcgen ;
2
2
3
+ import java .net .InetSocketAddress ;
3
4
import org .dcache .oncrpc4j .rpc .net .IpProtocolType ;
4
5
import org .dcache .oncrpc4j .rpc .OncRpcProgram ;
5
6
import org .dcache .oncrpc4j .rpc .OncRpcSvc ;
@@ -14,7 +15,7 @@ public abstract class AbstractCalculatorTest {
14
15
protected OncRpcSvc server ;
15
16
protected CalculatorClient client ;
16
17
protected String address = "127.0.0.1" ;
17
- protected int port = 6666 ;
18
+ protected int port = 0 ;
18
19
19
20
@ Before
20
21
public void setup () throws Exception {
@@ -27,9 +28,12 @@ public void setup() throws Exception{
27
28
.build ();
28
29
server .register (new OncRpcProgram (Calculator .CALCULATOR , Calculator .CALCULATORVERS ), serverImpl );
29
30
server .start ();
31
+
32
+ InetSocketAddress sockAddr = server .getInetSocketAddress (IpProtocolType .TCP );
33
+
30
34
client = new CalculatorClient (
31
35
InetAddress .getByName (address ),
32
- port ,
36
+ sockAddr . getPort () ,
33
37
Calculator .CALCULATOR ,
34
38
Calculator .CALCULATORVERS ,
35
39
IpProtocolType .TCP );
You can’t perform that action at this time.
0 commit comments