Example usage for java.net URLConnection getConnectTimeout

List of usage examples for java.net URLConnection getConnectTimeout

Introduction

In this page you can find the example usage for java.net URLConnection getConnectTimeout.

Prototype

public int getConnectTimeout() 

Source Link

Document

Returns setting for connect timeout.

Usage

From source file:Main.java

public static void main(String args[]) throws Exception {

    URL u = new URL("http://www.java2s.com");
    URLConnection uc = u.openConnection();

    System.out.println(uc.getConnectTimeout());
}

From source file:Main.java

public static void main(String args[]) throws Exception {

    URL u = new URL("http://www.java2s.com");
    URLConnection uc = u.openConnection();

    uc.setConnectTimeout(1000);/*  w  w  w  .  j  a  v a  2s.c  om*/
    System.out.println(uc.getConnectTimeout());
}