@@ -69,7 +69,6 @@ public class WolfSSLSocket extends SSLSocket {
6969 private Socket socket = null ;
7070 private boolean autoClose ;
7171 private InetSocketAddress address = null ;
72- private int readTimeout = 0 ;
7372
7473 private WolfSSLInputStream inStream ;
7574 private WolfSSLOutputStream outStream ;
@@ -1283,7 +1282,6 @@ public void setSoTimeout(int timeout) throws SocketException {
12831282 } else {
12841283 super .setSoTimeout (timeout );
12851284 }
1286- this .readTimeout = timeout ;
12871285 }
12881286
12891287 /**
@@ -1295,7 +1293,11 @@ public void setSoTimeout(int timeout) throws SocketException {
12951293 */
12961294 @ Override
12971295 public int getSoTimeout () throws SocketException {
1298- return this .readTimeout ;
1296+ if (this .socket != null ) {
1297+ return this .socket .getSoTimeout ();
1298+ } else {
1299+ return super .getSoTimeout ();
1300+ }
12991301 }
13001302
13011303 /**
@@ -1324,6 +1326,8 @@ synchronized public void setSSLParameters(SSLParameters params) {
13241326 @ Override
13251327 synchronized public void close () throws IOException {
13261328
1329+ int ret ;
1330+
13271331 WolfSSLDebug .log (getClass (), WolfSSLDebug .INFO ,
13281332 "entered close()" );
13291333
@@ -1353,7 +1357,11 @@ synchronized public void close() throws IOException {
13531357 WolfSSLDebug .log (getClass (), WolfSSLDebug .INFO ,
13541358 "thread got ioLock (shutdown)" );
13551359
1356- int ret = ssl .shutdownSSL (this .readTimeout );
1360+ if (this .socket != null ) {
1361+ ret = ssl .shutdownSSL (this .socket .getSoTimeout ());
1362+ } else {
1363+ ret = ssl .shutdownSSL (super .getSoTimeout ());
1364+ }
13571365 WolfSSLDebug .log (getClass (), WolfSSLDebug .INFO ,
13581366 "ssl.shutdownSSL() ret = " + ret );
13591367
@@ -1655,9 +1663,9 @@ public int read(byte[] b, int off, int len)
16551663 int err ;
16561664
16571665 WolfSSLDebug .log (getClass (), WolfSSLDebug .INFO ,
1658- "ssl.read() socket timeout = " + socket .readTimeout );
1666+ "ssl.read() socket timeout = " + socket .getSoTimeout () );
16591667
1660- ret = ssl .read (data , len , socket .readTimeout );
1668+ ret = ssl .read (data , len , socket .getSoTimeout () );
16611669 err = ssl .getError (ret );
16621670
16631671 WolfSSLDebug .log (getClass (), WolfSSLDebug .INFO ,
0 commit comments