test/jdk/java/net/httpclient/ConnectTimeoutNoProxyAsync.java
author dfuchs
Tue, 01 Oct 2019 12:10:33 +0100
changeset 58423 54de0c861d32
parent 51364 31d9e82b2e64
permissions -rw-r--r--
8231506: Fix some instabilities in a few networking tests Reviewed-by: alanb, chegar, msheppar
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
51364
31d9e82b2e64 8208391: Differentiate response and connect timeouts in HTTP Client API
chegar
parents:
diff changeset
     1
/*
31d9e82b2e64 8208391: Differentiate response and connect timeouts in HTTP Client API
chegar
parents:
diff changeset
     2
 * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
31d9e82b2e64 8208391: Differentiate response and connect timeouts in HTTP Client API
chegar
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
31d9e82b2e64 8208391: Differentiate response and connect timeouts in HTTP Client API
chegar
parents:
diff changeset
     4
 *
31d9e82b2e64 8208391: Differentiate response and connect timeouts in HTTP Client API
chegar
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
31d9e82b2e64 8208391: Differentiate response and connect timeouts in HTTP Client API
chegar
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
31d9e82b2e64 8208391: Differentiate response and connect timeouts in HTTP Client API
chegar
parents:
diff changeset
     7
 * published by the Free Software Foundation.
31d9e82b2e64 8208391: Differentiate response and connect timeouts in HTTP Client API
chegar
parents:
diff changeset
     8
 *
31d9e82b2e64 8208391: Differentiate response and connect timeouts in HTTP Client API
chegar
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
31d9e82b2e64 8208391: Differentiate response and connect timeouts in HTTP Client API
chegar
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
31d9e82b2e64 8208391: Differentiate response and connect timeouts in HTTP Client API
chegar
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
31d9e82b2e64 8208391: Differentiate response and connect timeouts in HTTP Client API
chegar
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
31d9e82b2e64 8208391: Differentiate response and connect timeouts in HTTP Client API
chegar
parents:
diff changeset
    13
 * accompanied this code).
31d9e82b2e64 8208391: Differentiate response and connect timeouts in HTTP Client API
chegar
parents:
diff changeset
    14
 *
31d9e82b2e64 8208391: Differentiate response and connect timeouts in HTTP Client API
chegar
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
31d9e82b2e64 8208391: Differentiate response and connect timeouts in HTTP Client API
chegar
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
31d9e82b2e64 8208391: Differentiate response and connect timeouts in HTTP Client API
chegar
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
31d9e82b2e64 8208391: Differentiate response and connect timeouts in HTTP Client API
chegar
parents:
diff changeset
    18
 *
31d9e82b2e64 8208391: Differentiate response and connect timeouts in HTTP Client API
chegar
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
31d9e82b2e64 8208391: Differentiate response and connect timeouts in HTTP Client API
chegar
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
31d9e82b2e64 8208391: Differentiate response and connect timeouts in HTTP Client API
chegar
parents:
diff changeset
    21
 * questions.
31d9e82b2e64 8208391: Differentiate response and connect timeouts in HTTP Client API
chegar
parents:
diff changeset
    22
 */
31d9e82b2e64 8208391: Differentiate response and connect timeouts in HTTP Client API
chegar
parents:
diff changeset
    23
31d9e82b2e64 8208391: Differentiate response and connect timeouts in HTTP Client API
chegar
parents:
diff changeset
    24
import java.net.http.HttpClient.Version;
31d9e82b2e64 8208391: Differentiate response and connect timeouts in HTTP Client API
chegar
parents:
diff changeset
    25
import java.time.Duration;
31d9e82b2e64 8208391: Differentiate response and connect timeouts in HTTP Client API
chegar
parents:
diff changeset
    26
import org.testng.annotations.Test;
31d9e82b2e64 8208391: Differentiate response and connect timeouts in HTTP Client API
chegar
parents:
diff changeset
    27
31d9e82b2e64 8208391: Differentiate response and connect timeouts in HTTP Client API
chegar
parents:
diff changeset
    28
/*
31d9e82b2e64 8208391: Differentiate response and connect timeouts in HTTP Client API
chegar
parents:
diff changeset
    29
 * @test
31d9e82b2e64 8208391: Differentiate response and connect timeouts in HTTP Client API
chegar
parents:
diff changeset
    30
 * @summary Tests for connection related timeouts
31d9e82b2e64 8208391: Differentiate response and connect timeouts in HTTP Client API
chegar
parents:
diff changeset
    31
 * @bug 8208391
31d9e82b2e64 8208391: Differentiate response and connect timeouts in HTTP Client API
chegar
parents:
diff changeset
    32
 * @run testng/othervm ConnectTimeoutNoProxyAsync
31d9e82b2e64 8208391: Differentiate response and connect timeouts in HTTP Client API
chegar
parents:
diff changeset
    33
 */
31d9e82b2e64 8208391: Differentiate response and connect timeouts in HTTP Client API
chegar
parents:
diff changeset
    34
31d9e82b2e64 8208391: Differentiate response and connect timeouts in HTTP Client API
chegar
parents:
diff changeset
    35
public class ConnectTimeoutNoProxyAsync extends AbstractConnectTimeout {
31d9e82b2e64 8208391: Differentiate response and connect timeouts in HTTP Client API
chegar
parents:
diff changeset
    36
31d9e82b2e64 8208391: Differentiate response and connect timeouts in HTTP Client API
chegar
parents:
diff changeset
    37
    @Test(dataProvider = "variants")
31d9e82b2e64 8208391: Differentiate response and connect timeouts in HTTP Client API
chegar
parents:
diff changeset
    38
    @Override
31d9e82b2e64 8208391: Differentiate response and connect timeouts in HTTP Client API
chegar
parents:
diff changeset
    39
    public void timeoutNoProxyAsync(Version requestVersion,
31d9e82b2e64 8208391: Differentiate response and connect timeouts in HTTP Client API
chegar
parents:
diff changeset
    40
                                    String scheme,
31d9e82b2e64 8208391: Differentiate response and connect timeouts in HTTP Client API
chegar
parents:
diff changeset
    41
                                    String method,
31d9e82b2e64 8208391: Differentiate response and connect timeouts in HTTP Client API
chegar
parents:
diff changeset
    42
                                    Duration connectTimeout,
31d9e82b2e64 8208391: Differentiate response and connect timeouts in HTTP Client API
chegar
parents:
diff changeset
    43
                                    Duration requestduration)
31d9e82b2e64 8208391: Differentiate response and connect timeouts in HTTP Client API
chegar
parents:
diff changeset
    44
    {
31d9e82b2e64 8208391: Differentiate response and connect timeouts in HTTP Client API
chegar
parents:
diff changeset
    45
        super.timeoutNoProxyAsync(requestVersion, scheme, method, connectTimeout, requestduration);
31d9e82b2e64 8208391: Differentiate response and connect timeouts in HTTP Client API
chegar
parents:
diff changeset
    46
    }
31d9e82b2e64 8208391: Differentiate response and connect timeouts in HTTP Client API
chegar
parents:
diff changeset
    47
}