]> WPIA git - gigi.git/blobdiff - tests/org/cacert/gigi/TestSSL.java
Move 2 test util classes to the "testUtils" package
[gigi.git] / tests / org / cacert / gigi / TestSSL.java
index 2ae757f9e8e129462c3292ff7edcce87a107fad5..9756a7f3f4e2a044acd5860d1b58c000bf84fee5 100644 (file)
@@ -6,15 +6,18 @@ import java.net.InetSocketAddress;
 import java.nio.ByteBuffer;
 import java.nio.channels.SocketChannel;
 import java.security.NoSuchAlgorithmException;
+
 import javax.net.ssl.SSLContext;
 import javax.net.ssl.SSLEngine;
 import javax.net.ssl.SSLEngineResult;
-import javax.net.ssl.SSLException;
 import javax.net.ssl.SSLEngineResult.HandshakeStatus;
+import javax.net.ssl.SSLException;
 
+import org.cacert.gigi.testUtils.InitTruststore;
+import org.cacert.gigi.testUtils.ManagedTest;
 import org.junit.Test;
 
-public class TestSSL {
+public class TestSSL extends ManagedTest {
        private ByteBuffer in;
        private ByteBuffer inC;
        private ByteBuffer outC;
@@ -27,8 +30,9 @@ public class TestSSL {
                        throws NoSuchAlgorithmException, IOException {
                SSLContext sc = SSLContext.getDefault();
                SSLEngine se = sc.createSSLEngine();
-               SocketChannel s = SocketChannel.open(new InetSocketAddress("localhost",
-                               443));
+               String[] serverParts = getServerName().split(":", 2);
+               SocketChannel s = SocketChannel.open(new InetSocketAddress(
+                               serverParts[0], Integer.parseInt(serverParts[1])));
 
                in = ByteBuffer.allocate(se.getSession().getApplicationBufferSize());
                inC = ByteBuffer.allocate(se.getSession().getPacketBufferSize());
@@ -44,7 +48,7 @@ public class TestSSL {
                try {
                        work(se, s);
                        throw new Error(
-                                       "Client re-negotiation failed (possible DoS vurnability");
+                                       "Client re-negotiation succeded (possible DoS vulnerability");
                } catch (EOFException e) {
                        // Cool, server closed connection
                }