Code example for URLConnection

Methods: connectsetConnectTimeout

0
		@Override 
		protected Boolean doInBackground(final Void... params) {
			try { 
				URL url = new URL("https://www.digipost.no");
				URLConnection connection = url.openConnection();
				connection.setConnectTimeout(3000);
				connection.connect();
				return true; 
			} catch (Exception e) {
				return false; 
			} 
		} 
	} 
} 
Stop searching for code, let great code find you!  Add Codota to your java IDE