File tree Expand file tree Collapse file tree 3 files changed +18
-21
lines changed
src/main/java/org/java_websocket Expand file tree Collapse file tree 3 files changed +18
-21
lines changed Original file line number Diff line number Diff line change 3535import org .java_websocket .exceptions .WebsocketNotConnectedException ;
3636import org .java_websocket .framing .Framedata ;
3737
38- import javax .net .ssl .SSLEngine ;
38+ import javax .net .ssl .SSLSession ;
3939
4040public interface WebSocket {
4141
@@ -212,16 +212,16 @@ public interface WebSocket {
212212
213213 /**
214214 * Does this websocket use an encrypted (wss/ssl) or unencrypted (ws) connection
215- * @return true, if the websocket does use wss and therefore has a SSLEngine
215+ * @return true, if the websocket does use wss and therefore has a SSLSession
216216 * @since 1.4.1
217217 */
218- boolean hasSSLEngine ();
218+ boolean hasSSLSupport ();
219219
220220 /**
221- * Returns the ssl engine of websocket, if ssl/wss is used for this instance.
222- * @return the ssl engine of this websocket instance
223- * @throws IllegalArgumentException the underlying channel does not use ssl (use hasSSLEngine () to check)
221+ * Returns the ssl session of websocket, if ssl/wss is used for this instance.
222+ * @return the ssl session of this websocket instance
223+ * @throws IllegalArgumentException the underlying channel does not use ssl (use hasSSLSupport () to check)
224224 * @since 1.4.1
225225 */
226- SSLEngine getSSLEngine () throws IllegalArgumentException ;
226+ SSLSession getSSLSession () throws IllegalArgumentException ;
227227}
Original file line number Diff line number Diff line change 5252import org .slf4j .Logger ;
5353import org .slf4j .LoggerFactory ;
5454
55- import javax .net .ssl .SSLEngine ;
55+ import javax .net .ssl .SSLSession ;
5656
5757/**
5858 * Represents one end (client or server) of a single WebSocketImpl connection.
@@ -824,16 +824,16 @@ public <T> T getAttachment() {
824824 }
825825
826826 @ Override
827- public boolean hasSSLEngine () {
827+ public boolean hasSSLSupport () {
828828 return channel instanceof ISSLChannel ;
829829 }
830830
831831 @ Override
832- public SSLEngine getSSLEngine () {
833- if (!hasSSLEngine ()) {
834- throw new IllegalArgumentException ("This websocket does use ws instead of wss. No SSLEngine available." );
832+ public SSLSession getSSLSession () {
833+ if (!hasSSLSupport ()) {
834+ throw new IllegalArgumentException ("This websocket does use ws instead of wss. No SSLSession available." );
835835 }
836- return ((ISSLChannel ) channel ).getSSLEngine ();
836+ return ((ISSLChannel ) channel ).getSSLEngine (). getSession () ;
837837 }
838838
839839 @ Override
Original file line number Diff line number Diff line change 4141import java .util .concurrent .TimeUnit ;
4242
4343import javax .net .SocketFactory ;
44- import javax .net .ssl .SSLContext ;
45- import javax .net .ssl .SSLEngine ;
46- import javax .net .ssl .SSLException ;
47- import javax .net .ssl .SSLSocketFactory ;
44+ import javax .net .ssl .*;
4845
4946import org .java_websocket .AbstractWebSocket ;
5047import org .java_websocket .WebSocket ;
@@ -852,13 +849,13 @@ public String getResourceDescriptor() {
852849 }
853850
854851 @ Override
855- public boolean hasSSLEngine () {
856- return engine .hasSSLEngine ();
852+ public boolean hasSSLSupport () {
853+ return engine .hasSSLSupport ();
857854 }
858855
859856 @ Override
860- public SSLEngine getSSLEngine () {
861- return engine .getSSLEngine ();
857+ public SSLSession getSSLSession () {
858+ return engine .getSSLSession ();
862859 }
863860
864861 /**
You can’t perform that action at this time.
0 commit comments