ServerSocket serverSocket = new ServerSocket(); serverSocket.setReuseAddress(true); serverSocket.close();