Here you can find the source of isLivereloadAvailable(int port)
public static boolean isLivereloadAvailable(int port)
//package com.java2s; /******************************************************************************* * Copyright (c) 2015 Red Hat, Inc./*w w w . j a v a 2 s . c o m*/ * Distributed under license by Red Hat, Inc. All rights reserved. * This program is made available under the terms of the * Eclipse Public License v1.0 which accompanies this distribution, * and is available at http://www.eclipse.org/legal/epl-v10.html * * Contributor: * Red Hat, Inc. - initial API and implementation ******************************************************************************/ import java.io.IOException; import java.net.HttpURLConnection; import java.net.URL; public class Main { public static boolean isLivereloadAvailable(int port) { try { HttpURLConnection.setFollowRedirects(false); URL url = new URL("http://localhost:" + port + "/livereload.js"); //$NON-NLS-1$ //$NON-NLS-2$ HttpURLConnection con = (HttpURLConnection) url .openConnection(); con.setConnectTimeout(1000); con.setRequestMethod("HEAD"); //$NON-NLS-1$ return (con.getResponseCode() == HttpURLConnection.HTTP_OK); } catch (IOException e) { return false; } } }