net.vattp.tunnel
Class HTTPClient

java.lang.Object
  |
  +--net.vattp.tunnel.HTTPClient

public class HTTPClient
extends Object

Untamed:


Field Summary
private  Vector myInTCP
          Incoming TCP sockets.
private  Vector myOutTCP
          Outgoing TCP sockets.
private  ByteArrayOutputStream myResponses
           
private  byte[] mySessionID
           
 
Constructor Summary
(package private) HTTPClient(byte[] sessionID)
           
 
Method Summary
(package private)  void close(byte connectionID)
          Close a TCP connection.
(package private)  void disaster(Throwable t)
          Handle an error that occured while handling an error for this client.
(package private)  byte[] flushQueuedMsgs()
          Returns the messages to be returned to the client as part of an HTTP_Session message.
private  HTTPSocketCtl getSocketCtl(byte connectionID)
           
(package private)  void makeConnection(byte connectionID, String hostPort)
          Make a new outgoing TCP connection for the client.
private  void queueDataMsg(int connectionID, HTTPSocketCtl ctl)
          Queue a data message to be returned to the client as part of an HTTP_Session message.
(package private)  void queueMsg(byte[] message)
          Queue a message to be returned to the client as part of an HTTP_Session message.
(package private)  void sendData(byte connectionID, byte[] data)
          Send data to a TCP connection.
(package private)  void setSendLimit(byte connectionID, int limit)
          Set send limit for a particular connection.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

myInTCP

private final Vector myInTCP
Incoming TCP sockets. The connectionIDs are negative. The data is HTTPSocketCtl.


myOutTCP

private final Vector myOutTCP
Outgoing TCP sockets. The connectionIDs are positive. The data is HTTPSocketCtl.


mySessionID

private final byte[] mySessionID

myResponses

private final ByteArrayOutputStream myResponses
Constructor Detail

HTTPClient

HTTPClient(byte[] sessionID)
Method Detail

close

void close(byte connectionID)
Close a TCP connection.

Parameters:
connectionID - is the connectionID to close. If it is positive, then the connection was built as an outgoing connection. If it is negative, then it was built as an incoming one. The value zero is invalid.

disaster

void disaster(Throwable t)
Handle an error that occured while handling an error for this client.


flushQueuedMsgs

byte[] flushQueuedMsgs()
                 throws IOException
Returns the messages to be returned to the client as part of an HTTP_Session message. These messages will include any incoming data on the established TCP connections.

Returns:
is the messages to return to the client.
IOException

getSocketCtl

private HTTPSocketCtl getSocketCtl(byte connectionID)

makeConnection

void makeConnection(byte connectionID,
                    String hostPort)
Make a new outgoing TCP connection for the client.

Parameters:
connectionID - is the one byte connection ID, a positive number.
hostPort - is the host IP/DNS name : port number.

queueDataMsg

private void queueDataMsg(int connectionID,
                          HTTPSocketCtl ctl)
                   throws IOException
Queue a data message to be returned to the client as part of an HTTP_Session message.

IOException

queueMsg

void queueMsg(byte[] message)
Queue a message to be returned to the client as part of an HTTP_Session message.

Parameters:
message - is the message to queue.

sendData

void sendData(byte connectionID,
              byte[] data)
Send data to a TCP connection.

Parameters:
data - is the byte array to send.

setSendLimit

void setSendLimit(byte connectionID,
                  int limit)
Set send limit for a particular connection.

Parameters:
limit - is the new send limit.


comments?