java.net.HttpURLConnection.getReadTimeout()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(4.8k)|赞(0)|评价(0)|浏览(152)

本文整理了Java中java.net.HttpURLConnection.getReadTimeout()方法的一些代码示例,展示了HttpURLConnection.getReadTimeout()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。HttpURLConnection.getReadTimeout()方法的具体详情如下:
包路径:java.net.HttpURLConnection
类名称:HttpURLConnection
方法名:getReadTimeout

HttpURLConnection.getReadTimeout介绍

暂无

代码示例

代码示例来源:origin: square/okhttp

@Override public int getReadTimeout() {
 return delegate.getReadTimeout();
}

代码示例来源:origin: prestodb/presto

@Override public int getReadTimeout() {
 return delegate.getReadTimeout();
}

代码示例来源:origin: jersey/jersey

uc.setReadTimeout(request.resolveProperty(ClientProperties.READ_TIMEOUT, uc.getReadTimeout()));

代码示例来源:origin: jersey/jersey

uc.setReadTimeout(request.resolveProperty(ClientProperties.READ_TIMEOUT, uc.getReadTimeout()));

代码示例来源:origin: org.glassfish.jersey.core/jersey-client

uc.setReadTimeout(request.resolveProperty(ClientProperties.READ_TIMEOUT, uc.getReadTimeout()));

代码示例来源:origin: pwittchen/ReactiveNetwork

@Test public void shouldCreateHttpUrlConnection() throws IOException {
 // given
 final String parsedDefaultHost = "clients3.google.com";
 // when
 HttpURLConnection connection = strategy.createHttpUrlConnection(getHost(), PORT, TIMEOUT_IN_MS);
 // then
 assertThat(connection).isNotNull();
 assertThat(connection.getURL().getHost()).isEqualTo(parsedDefaultHost);
 assertThat(connection.getURL().getPort()).isEqualTo(PORT);
 assertThat(connection.getConnectTimeout()).isEqualTo(TIMEOUT_IN_MS);
 assertThat(connection.getReadTimeout()).isEqualTo(TIMEOUT_IN_MS);
 assertThat(connection.getInstanceFollowRedirects()).isFalse();
 assertThat(connection.getUseCaches()).isFalse();
}

代码示例来源:origin: apiman/apiman

@Override public int getReadTimeout() {
 return delegate.getReadTimeout();
}

代码示例来源:origin: EvoSuite/evosuite

@Override
public int getReadTimeout() {
  return super.getReadTimeout();
}

代码示例来源:origin: AgNO3/jcifs-ng

@Override
public int getReadTimeout () {
  return this.connection.getReadTimeout();
}

代码示例来源:origin: com.squareup.okhttp/okhttp-urlconnection

@Override public int getReadTimeout() {
 return delegate.getReadTimeout();
}

代码示例来源:origin: io.prestosql/presto-jdbc

@Override public int getReadTimeout() {
 return delegate.getReadTimeout();
}

代码示例来源:origin: org.codelibs/jcifs

@Override
public int getReadTimeout () {
  return this.connection.getReadTimeout();
}

代码示例来源:origin: prestosql/presto

@Override public int getReadTimeout() {
 return delegate.getReadTimeout();
}

代码示例来源:origin: com.squareup.okhttp3/okhttp-urlconnection

@Override public int getReadTimeout() {
 return delegate.getReadTimeout();
}

代码示例来源:origin: com.facebook.presto/presto-jdbc

@Override public int getReadTimeout() {
 return delegate.getReadTimeout();
}

代码示例来源:origin: jenkinsci/ghprb-plugin

public HttpURLConnection connect(URL url) throws IOException {
    HttpURLConnection con = (HttpURLConnection) ProxyConfiguration.open(url);

    // Set default timeouts in case there are none
    if (con.getConnectTimeout() == 0) {
      con.setConnectTimeout(DEFAULT_CONNECT_TIMEOUT);
    }
    if (con.getReadTimeout() == 0) {
      con.setReadTimeout(DEFAULT_READ_TIMEOUT);
    }
    return con;
  }
}

代码示例来源:origin: timols/java-gitlab-api

@Test
@DisplayName(value = "Expected success, calling the \"setupConnection\" method if the read timeout = 0")
public void unitTest_20180503202458() throws Exception {
  GitlabAPI api = mock(GitlabAPI.class);
  when(api.getResponseReadTimeout()).thenReturn(0);
  GitlabHTTPRequestor http = new GitlabHTTPRequestor(api);
  URL url = new URL("http://test.url");
  Method method = GitlabHTTPRequestor.class.getDeclaredMethod("setupConnection", URL.class);
  method.setAccessible(true);
  HttpURLConnection connection = (HttpURLConnection) method.invoke(http, url);
  assertThat(connection.getReadTimeout(), is(0));
}

代码示例来源:origin: timols/java-gitlab-api

@Test
@DisplayName(value = "Expected success, calling the \"setupConnection\" method if the read timeout > 0")
public void unitTest_20180503203531() throws Exception {
  GitlabAPI api = mock(GitlabAPI.class);
  when(api.getResponseReadTimeout()).thenReturn(555);
  GitlabHTTPRequestor http = new GitlabHTTPRequestor(api);
  URL url = new URL("http://test.url");
  Method method = GitlabHTTPRequestor.class.getDeclaredMethod("setupConnection", URL.class);
  method.setAccessible(true);
  HttpURLConnection connection = (HttpURLConnection) method.invoke(http, url);
  assertThat(connection.getReadTimeout(), is(555));
}

代码示例来源:origin: braintree/braintree_android

@Test(timeout = 1000)
public void setsDefaultReadTimeoutWhenNoTimeoutIsSet() throws IOException {
  HttpClient httpClient = new HttpClient();
  HttpURLConnection connection = httpClient.init("http://example.com/");
  assertEquals(30000, connection.getReadTimeout());
}

代码示例来源:origin: braintree/braintree_android

@Test(timeout = 1000)
public void setsReadTimeout() throws IOException {
  HttpClient httpClient = new HttpClient()
      .setReadTimeout(1000);
  HttpURLConnection connection = httpClient.init("http://example.com/");
  assertEquals(1000, connection.getReadTimeout());
}

相关文章

HttpURLConnection类方法