@@ -1150,7 +1150,9 @@ synchronized public void startHandshake() throws IOException {
11501150 try {
11511151 ret = EngineHelper .doHandshake (0 , this .getSoTimeout ());
11521152 } catch (SocketTimeoutException e ) {
1153- throw new IOException (e );
1153+ WolfSSLDebug .log (getClass (), WolfSSLDebug .INFO ,
1154+ "got socket timeout in doHandshake()" );
1155+ throw e ;
11541156 }
11551157
11561158 WolfSSLDebug .log (getClass (), WolfSSLDebug .INFO ,
@@ -1783,8 +1785,15 @@ public int read(byte[] b, int off, int len)
17831785 }
17841786
17851787 /* do handshake if not completed yet, handles synchronization */
1786- if (socket .handshakeComplete == false ) {
1787- socket .startHandshake ();
1788+ try {
1789+ /* do handshake if not completed yet, handles synchronization */
1790+ if (socket .handshakeComplete == false ) {
1791+ socket .startHandshake ();
1792+ }
1793+ } catch (SocketTimeoutException e ) {
1794+ WolfSSLDebug .log (getClass (), WolfSSLDebug .INFO ,
1795+ "got socket timeout in read()" );
1796+ throw e ;
17881797 }
17891798
17901799 if (b .length == 0 || len == 0 ) {
@@ -1901,9 +1910,15 @@ public void write(byte[] b, int off, int len) throws IOException {
19011910 }
19021911 }
19031912
1904- /* do handshake if not completed yet, handles synchronization */
1905- if (socket .handshakeComplete == false ) {
1906- socket .startHandshake ();
1913+ try {
1914+ /* do handshake if not completed yet, handles synchronization */
1915+ if (socket .handshakeComplete == false ) {
1916+ socket .startHandshake ();
1917+ }
1918+ } catch (SocketTimeoutException e ) {
1919+ WolfSSLDebug .log (getClass (), WolfSSLDebug .INFO ,
1920+ "got socket timeout in write()" );
1921+ throw e ;
19071922 }
19081923
19091924 if (off < 0 || len < 0 || (off + len ) > b .length ) {
0 commit comments