< prev index next >

test/java/nio/channels/ServerSocketChannel/AdaptServerSocket.java

Print this page




 106             if (shouldTimeout && (so != null))
 107                 throw new Exception("Accept did not time out");
 108 
 109             if (so != null) {
 110                 int a = 42;
 111                 so.getOutputStream().write(a);
 112                 int b = so.getInputStream().read();
 113                 if (b != a + 1)
 114                     throw new Exception("Read incorrect data");
 115                 out.println("server:  read " + b);
 116             }
 117         }
 118         client.interrupt();
 119         client.join();
 120         if (clientException != null)
 121             throw clientException;
 122     }
 123 
 124     public static void main(String[] args) throws Exception {
 125         test(0, 0, false);
 126         test(50, 500, false);
 127         test(500, 50, true);
 128     }
 129 
 130 }


 106             if (shouldTimeout && (so != null))
 107                 throw new Exception("Accept did not time out");
 108 
 109             if (so != null) {
 110                 int a = 42;
 111                 so.getOutputStream().write(a);
 112                 int b = so.getInputStream().read();
 113                 if (b != a + 1)
 114                     throw new Exception("Read incorrect data");
 115                 out.println("server:  read " + b);
 116             }
 117         }
 118         client.interrupt();
 119         client.join();
 120         if (clientException != null)
 121             throw clientException;
 122     }
 123 
 124     public static void main(String[] args) throws Exception {
 125         test(0, 0, false);
 126         test(50, 5000, false);
 127         test(500, 50, true);
 128     }
 129 
 130 }
< prev index next >