File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed
org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change 16
16
import java .io .File ;
17
17
import java .io .IOException ;
18
18
import java .io .InputStream ;
19
+ import java .net .ServerSocket ;
19
20
import java .net .URISyntaxException ;
20
21
import java .util .Iterator ;
21
22
import java .util .List ;
@@ -1205,7 +1206,16 @@ public void shutDownTarget() {
1205
1206
// We want subsequent connections to use different ports, unless a
1206
1207
// VM exec sting is given.
1207
1208
if (fVmCmd == null ) {
1208
- fBackEndPort += 2 ;
1209
+ ServerSocket socket ;
1210
+ try {
1211
+ socket = new ServerSocket (0 );
1212
+ int availablePort = socket .getLocalPort ();
1213
+ socket .close (); //Available but always initialized
1214
+ fBackEndPort = availablePort ;
1215
+ } catch (IOException e ) {
1216
+ fBackEndPort +=2 ;
1217
+
1218
+ }
1209
1219
}
1210
1220
}
1211
1221
/**
You can’t perform that action at this time.
0 commit comments