查找空闲端口
/** * N o w J a v a . c o m - 时 代 Java 提 供 **/ //package com.nowjava; import java.io.IOException; import java.net.ServerSocket; public class Main { public static int findFreePort() { try { ServerSocket server = new ServerSocket(0); int port = server.getLocalPort(); server.close(); return port; } catch (IOException e) { throw new RuntimeException(