Code example for URLConnection

Methods: connect, setConnectTimeout

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; 
			} 
		} 
	} 
}