juju.reattore.loadtest.controller.impl
Class URLTester

java.lang.Object
  |
  +--juju.reattore.loadtest.controller.impl.URLTester
All Implemented Interfaces:
ClientSocketHandler, Handler

public class URLTester
extends java.lang.Object
implements ClientSocketHandler

Very simple URL tester that gets the contents of the given URL from the given socket.


Constructor Summary
URLTester(java.nio.channels.SocketChannel ch, java.net.URL url)
          Create a new tester for later use.
 
Method Summary
 int getInterestOps()
          Returns the set of operations this handler is currently interested in.
 boolean handleConnected()
          Called when the socket is initially connected.
 void handleError()
          Called when any error occurs on the attached socket.
 boolean handleReadable()
          Called when the attached socket has data available.
 boolean handleWritable()
          Called when the attached socket is ready to be written to.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

URLTester

public URLTester(java.nio.channels.SocketChannel ch,
                 java.net.URL url)
Create a new tester for later use.

Parameters:
ch - An existing unused socket channel.
url - The URL to connect to later.
Method Detail

handleConnected

public boolean handleConnected()
                        throws java.io.IOException
Description copied from interface: ClientSocketHandler
Called when the socket is initially connected. This does not imply that the channel is readable or writable.

Specified by:
handleConnected in interface ClientSocketHandler
Returns:
true if processing has finished and this socket should be closed.
Throws:
java.io.IOException - if a fatal IO error occurred.
See Also:
ClientSocketHandler

handleReadable

public boolean handleReadable()
                       throws java.io.IOException
Description copied from interface: ClientSocketHandler
Called when the attached socket has data available.

Specified by:
handleReadable in interface ClientSocketHandler
Returns:
true if processing has finished and this socket should be closed.
Throws:
java.io.IOException - if a fatal IO error occurred.
See Also:
ClientSocketHandler

handleWritable

public boolean handleWritable()
                       throws java.io.IOException
Description copied from interface: ClientSocketHandler
Called when the attached socket is ready to be written to.

Specified by:
handleWritable in interface ClientSocketHandler
Returns:
true if processing has finished and this socket should be closed.
Throws:
java.io.IOException - if a fatal IO error occurred.
See Also:
ClientSocketHandler

getInterestOps

public int getInterestOps()
Description copied from interface: Handler
Returns the set of operations this handler is currently interested in. See SelectorKey for more informration.

Specified by:
getInterestOps in interface Handler
Returns:
Bitvect of SelectorKey.OP_*
See Also:
ClientSocketHandler

handleError

public void handleError()
Description copied from interface: ClientSocketHandler
Called when any error occurs on the attached socket. Does not distinguish between connection, transient, or fatal errors. The socket may not be usable.

Specified by:
handleError in interface ClientSocketHandler
See Also:
ClientSocketHandler


Copyright © 2002-2003 Michael Hope. All Rights Reserved.