Add test for resumption with non-blocking I/O
diff --git a/programs/ssl/ssl_client2.c b/programs/ssl/ssl_client2.c
index 375badb..5996994 100644
--- a/programs/ssl/ssl_client2.c
+++ b/programs/ssl/ssl_client2.c
@@ -990,7 +990,8 @@
     ssl_set_dbg( &ssl, my_debug, stdout );
 
     if( opt.nbio == 2 )
-        ssl_set_bio_timeout( &ssl, &server_fd, my_send, my_recv, NULL, 0 );
+        ssl_set_bio_timeout( &ssl, &server_fd, my_send, my_recv, NULL,
+                             opt.read_timeout );
     else
         ssl_set_bio_timeout( &ssl, &server_fd, net_send, net_recv,
 #if defined(POLARSSL_HAVE_TIME)
@@ -1392,6 +1393,17 @@
             goto exit;
         }
 
+        if( opt.nbio > 0 )
+            ret = net_set_nonblock( server_fd );
+        else
+            ret = net_set_block( server_fd );
+        if( ret != 0 )
+        {
+            printf( " failed\n  ! net_set_(non)block() returned -0x%x\n\n",
+                    -ret );
+            goto exit;
+        }
+
         while( ( ret = ssl_handshake( &ssl ) ) != 0 )
         {
             if( ret != POLARSSL_ERR_NET_WANT_READ &&