< prev index next >

test/jdk/java/net/httpclient/http2/ErrorTest.java

Print this page




   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 /*
  25  * @test
  26  * @bug 8157105
  27  * @library /lib/testlibrary server
  28  * @build jdk.testlibrary.SimpleSSLContext
  29  * @modules jdk.incubator.httpclient/jdk.incubator.http.internal.common

  30  *          jdk.incubator.httpclient/jdk.incubator.http.internal.frame
  31  *          jdk.incubator.httpclient/jdk.incubator.http.internal.hpack
  32  *          java.security.jgss
  33  * @run testng/othervm/timeout=60 -Djavax.net.debug=ssl -Djdk.httpclient.HttpClient.log=all ErrorTest
  34  * @summary check exception thrown when bad TLS parameters selected
  35  */
  36 
  37 import java.io.IOException;
  38 import java.net.URI;
  39 import jdk.incubator.http.HttpClient;
  40 import jdk.incubator.http.HttpRequest;
  41 import jdk.incubator.http.HttpResponse;
  42 import javax.net.ssl.SSLContext;
  43 import javax.net.ssl.SSLParameters;
  44 import java.util.concurrent.Executors;
  45 import java.util.concurrent.ExecutorService;
  46 import jdk.testlibrary.SimpleSSLContext;
  47 import static jdk.incubator.http.HttpClient.Version.HTTP_2;
  48 import static jdk.incubator.http.HttpRequest.BodyProcessor.fromString;
  49 import static jdk.incubator.http.HttpResponse.BodyHandler.discard;
  50 
  51 import org.testng.annotations.Test;
  52 
  53 /**
  54  * When selecting an unacceptable cipher suite the TLS handshake will fail.
  55  * But, the exception that was thrown was not being returned up to application
  56  * causing hang problems
  57  */
  58 public class ErrorTest {
  59 
  60     static final String[] CIPHER_SUITES = new String[]{ "TLS_KRB5_WITH_3DES_EDE_CBC_SHA" };
  61 
  62     static final String SIMPLE_STRING = "Hello world Goodbye world";
  63 
  64     //@Test(timeOut=5000)
  65     @Test
  66     public void test() throws Exception {
  67         SSLContext sslContext = (new SimpleSSLContext()).get();
  68         ExecutorService exec = Executors.newCachedThreadPool();




   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 /*
  25  * @test
  26  * @bug 8157105
  27  * @library /lib/testlibrary server
  28  * @build jdk.testlibrary.SimpleSSLContext
  29  * @modules java.base/sun.net.www.http
  30  *          jdk.incubator.httpclient/jdk.incubator.http.internal.common
  31  *          jdk.incubator.httpclient/jdk.incubator.http.internal.frame
  32  *          jdk.incubator.httpclient/jdk.incubator.http.internal.hpack
  33  *          java.security.jgss
  34  * @run testng/othervm/timeout=60 -Djavax.net.debug=ssl -Djdk.httpclient.HttpClient.log=all ErrorTest
  35  * @summary check exception thrown when bad TLS parameters selected
  36  */
  37 
  38 import java.io.IOException;
  39 import java.net.URI;
  40 import jdk.incubator.http.HttpClient;
  41 import jdk.incubator.http.HttpRequest;
  42 import jdk.incubator.http.HttpResponse;
  43 import javax.net.ssl.SSLContext;
  44 import javax.net.ssl.SSLParameters;
  45 import java.util.concurrent.Executors;
  46 import java.util.concurrent.ExecutorService;
  47 import jdk.testlibrary.SimpleSSLContext;
  48 import static jdk.incubator.http.HttpClient.Version.HTTP_2;
  49 import static jdk.incubator.http.HttpRequest.BodyPublisher.fromString;
  50 import static jdk.incubator.http.HttpResponse.BodyHandler.discard;
  51 
  52 import org.testng.annotations.Test;
  53 
  54 /**
  55  * When selecting an unacceptable cipher suite the TLS handshake will fail.
  56  * But, the exception that was thrown was not being returned up to application
  57  * causing hang problems
  58  */
  59 public class ErrorTest {
  60 
  61     static final String[] CIPHER_SUITES = new String[]{ "TLS_KRB5_WITH_3DES_EDE_CBC_SHA" };
  62 
  63     static final String SIMPLE_STRING = "Hello world Goodbye world";
  64 
  65     //@Test(timeOut=5000)
  66     @Test
  67     public void test() throws Exception {
  68         SSLContext sslContext = (new SimpleSSLContext()).get();
  69         ExecutorService exec = Executors.newCachedThreadPool();


< prev index next >