Adding JMCR-Stable version
[Benchmarks_CSolver.git] / JMCR-Stable / real-world application / jigsaw / src / org / w3c / jigsaw / https / socket / SSLSocketClient.java
diff --git a/JMCR-Stable/real-world application/jigsaw/src/org/w3c/jigsaw/https/socket/SSLSocketClient.java b/JMCR-Stable/real-world application/jigsaw/src/org/w3c/jigsaw/https/socket/SSLSocketClient.java
new file mode 100644 (file)
index 0000000..28e9a33
--- /dev/null
@@ -0,0 +1,76 @@
+/**\r
+ * Copyright (c) 2000/2001 Thomas Kopp\r
+ * All rights reserved.\r
+ *\r
+ * Redistribution and use in source and binary forms, with or without\r
+ * modification, are permitted provided that the following conditions\r
+ * are met:\r
+ * 1. Redistributions of source code must retain the above copyright\r
+ *    notice, this list of conditions and the following disclaimer.\r
+ * 2. Redistributions in binary form must reproduce the above copyright\r
+ *    notice, this list of conditions and the following disclaimer in the\r
+ *    documentation and/or other materials provided with the distribution.\r
+ *\r
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\r
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\r
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\r
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\r
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\r
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\r
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\r
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\r
+ * SUCH DAMAGE.\r
+ */\r
+// $Id: SSLSocketClient.java,v 1.1 2010/06/15 12:28:29 smhuang Exp $\r
+\r
+package org.w3c.jigsaw.https.socket;\r
+\r
+import java.net.Socket;\r
+\r
+import javax.net.ssl.SSLSession;\r
+import javax.net.ssl.SSLSocket;\r
+\r
+import org.w3c.jigsaw.http.httpd;\r
+import org.w3c.jigsaw.http.socket.SocketClient;\r
+import org.w3c.jigsaw.http.socket.SocketClientFactory;\r
+import org.w3c.jigsaw.http.socket.SocketClientState;\r
+\r
+/**\r
+ * @author Thomas Kopp, Dialogika GmbH\r
+ * @version 1.1, 6 February 2004\r
+ * \r
+ * This class extends a Jigsaw SocketClient designed for the \r
+ * http protocol\r
+ * in order to supply a SocketClient for the https protocol including \r
+ * client authentication in accordance with the JSSE API.\r
+ */\r
+public class SSLSocketClient extends SocketClient {\r
+\r
+    /**\r
+     * Creates an empty client.\r
+     *\r
+     * @param server  the target http(s( daemon\r
+     * @param pool  the client factory in use\r
+     * @param state  the socket cliente state in use\r
+     */\r
+\r
+    protected SSLSocketClient(httpd server, SocketClientFactory pool,\r
+                             SocketClientState state) {\r
+       super(server, pool, state);\r
+    }\r
+    \r
+    /**\r
+     * Supplies the ssl session associated with the underlying socket.\r
+     *\r
+     * @return  the associated ssl session or null\r
+     */\r
+    public SSLSession getSession() {\r
+        // the socket instance is inherited from the super-class\r
+        if (socket instanceof SSLSocket) {\r
+           return ((SSLSocket)socket).getSession();\r
+        }\r
+        return null;\r
+    }\r
+}\r