< prev index next >

test/sun/rmi/transport/tcp/blockAccept/BlockAcceptTest.java

Print this page




  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 /* @test
  25  * @bug 4203167
  26  *
  27  * @summary RMI blocks in HttpAwareServerSocket.accept() if you telnet to it
  28  * @author Adrian Colley
  29  *
  30  * @library ../../../../../java/rmi/testlibrary

  31  * @build TestIface TestImpl TestImpl_Stub
  32  * @run main/othervm/policy=security.policy/timeout=60 BlockAcceptTest
  33  */
  34 
  35 /* This test attempts to stymie the RMI accept loop.  The accept loop in
  36  * RMI endlessly accepts a connection, spawns a thread for it, and repeats.
  37  * The accept() call can be replaced by a user-supplied library which
  38  * might foolishly block indefinitely in its accept() method, which would
  39  * prevent RMI from accepting other connections on that socket.
  40  *
  41  * Unfortunately, HttpAwareServerSocket (default server socket) is/was such
  42  * a foolish thing.  It reads 4 bytes to see if they're "POST" before
  43  * returning.  The bug fix is to move the HTTP stuff into the mainloop,
  44  * which has the side effect of enabling it for non-default socketfactories.
  45  *
  46  * This test:
  47  * 1. Creates an object and exports it.
  48  * 2. Connects to the listening RMI port and sends nothing, to hold it up.
  49  * 3. Makes a regular call, using HTTP tunnelling.
  50  * 4. Fails to deadlock, thereby passing the test.




  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 /* @test
  25  * @bug 4203167
  26  *
  27  * @summary RMI blocks in HttpAwareServerSocket.accept() if you telnet to it
  28  * @author Adrian Colley
  29  *
  30  * @library ../../../../../java/rmi/testlibrary
  31  * @modules java.rmi/sun.rmi.transport.proxy
  32  * @build TestIface TestImpl TestImpl_Stub
  33  * @run main/othervm/policy=security.policy/timeout=60 BlockAcceptTest
  34  */
  35 
  36 /* This test attempts to stymie the RMI accept loop.  The accept loop in
  37  * RMI endlessly accepts a connection, spawns a thread for it, and repeats.
  38  * The accept() call can be replaced by a user-supplied library which
  39  * might foolishly block indefinitely in its accept() method, which would
  40  * prevent RMI from accepting other connections on that socket.
  41  *
  42  * Unfortunately, HttpAwareServerSocket (default server socket) is/was such
  43  * a foolish thing.  It reads 4 bytes to see if they're "POST" before
  44  * returning.  The bug fix is to move the HTTP stuff into the mainloop,
  45  * which has the side effect of enabling it for non-default socketfactories.
  46  *
  47  * This test:
  48  * 1. Creates an object and exports it.
  49  * 2. Connects to the listening RMI port and sends nothing, to hold it up.
  50  * 3. Makes a regular call, using HTTP tunnelling.
  51  * 4. Fails to deadlock, thereby passing the test.


< prev index next >