@@ -0,0 +1,1281 @@
+/*%0A * Copyright %C2%A9 2017 jjYBdx4IL (https://github.com/jjYBdx4IL)%0A *%0A * Licensed under the Apache License, Version 2.0 (the %22License%22);%0A * you may not use this file except in compliance with the License.%0A * You may obtain a copy of the License at%0A *%0A *     http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A */%0Apackage com.github.jjYBdx4IL.utils.net;%0A%0Aimport java.net.InetSocketAddress;%0Aimport java.net.Socket;%0A%0A//CHECKSTYLE:OFF%0Apublic class PortUtils %7B%0A    %0A    public static final int DEFAULT_WAIT_MILLIS = 1000;%0A    %0A    public static boolean isOpen(int port) %7B%0A        return isOpen(%22localhost%22, port, DEFAULT_WAIT_MILLIS);%0A    %7D%0A    %0A    public static boolean isOpen(String host, int port, int millis) %7B%0A        try %7B%0A            Socket socket = new Socket();%0A            socket.connect(new InetSocketAddress(host, port), millis);%0A            socket.close();%0A            return true;%0A        %7D catch (Exception ex) %7B%0A            return false;%0A        %7D%0A    %7D%0A%7D%0A

add PortUtils