UC Berkeley Group for User Interface Research
Updated November 17, 2000

edu.berkeley.guir.lib.net
Class Proxy

java.lang.Object
  |
  +--java.lang.Thread
        |
        +--edu.berkeley.guir.lib.net.GenericServer
              |
              +--edu.berkeley.guir.lib.net.Proxy
All Implemented Interfaces:
NetConstants, Runnable

public class Proxy
extends GenericServer
implements NetConstants

A non-threaded generic proxy between a client and a server.

The client thinks the Proxy is the server. The server thinks the Proxy is the client.

When the client sends data to the Proxy, the Proxy reads in the bytes, filters the input, and forwards the filtered bytes to the server.

When the server sends data to the Proxy, the Proxy reads in the bytes, filters the input (through a different filter), and forwards the filtered bytes to the client.

         ------- proxyport --->       -- dstaddr dstport -->
  Client                        Proxy                        Server
         <---------------------       <---------------------
 

This software is distributed under the Berkeley Software License.

 Revisions:  - GUIRLib-v1.2-1.0.0, Jul 22 2000, JH
               Created class
             - GUIRLib-v1.3-1.0.0, Aug 11 2000, JH
               Touched for GUIRLib release
             - GUIRLib-v1.4-1.0.0, Aug 31 2000, JH
               Touched for GUIRLib release
 

Since:
1.1.6
Version:
GUIRLib-v1.4-1.0.0, Aug 31 2000
Author:
Jason Hong ( jasonh@cs.berkeley.edu

Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Fields inherited from interface edu.berkeley.guir.lib.net.NetConstants
ANYPORT, DEFAULT_TIMEOUT, NO_TIMEOUT
 
Constructor Summary
protected Proxy()
          Just in case this class ever needs to be subclassed.
  Proxy(int proxyport, InetAddress dstaddr, int dstport)
          Create a Proxy listening on the specified port with the default timeout.
  Proxy(int proxyport, InetAddress dstaddr, int dstport, int timeout)
          Create a Proxy listening on the specified port with the specified timeout.
 
Method Summary
static void main(String[] argv)
           
 void setDestinationAddress(InetAddress addr)
          Set the address the proxy will connect to.
 void setDestinationPort(int port)
          Set the port the proxy will connect to.
 void setInputFilter(Filter f)
          Set the filter for input from client to server.
 void setOutputFilter(Filter f)
          Set the filter for output from server to client.
 
Methods inherited from class edu.berkeley.guir.lib.net.GenericServer
close, run, setPlugin, setServerPort, setTimeout
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Proxy

protected Proxy()
Just in case this class ever needs to be subclassed.

Proxy

public Proxy(int proxyport,
             InetAddress dstaddr,
             int dstport)
Create a Proxy listening on the specified port with the default timeout.
Parameters:
proxyport - is the port number to listen on.
dstaddr - is the destination address to connect to.
dstport - is the destination port to connect to.

Proxy

public Proxy(int proxyport,
             InetAddress dstaddr,
             int dstport,
             int timeout)
Create a Proxy listening on the specified port with the specified timeout.
Parameters:
proxyport - is the port number to listen on.
dstaddr - is the destination address to connect to.
dstport - is the destination port to connect to.
timeout - is the timeout for the system.
Method Detail

setInputFilter

public void setInputFilter(Filter f)
Set the filter for input from client to server.
Parameters:
f - is the filter to use.

setOutputFilter

public void setOutputFilter(Filter f)
Set the filter for output from server to client.
Parameters:
f - is the filter to use.

setDestinationPort

public void setDestinationPort(int port)
Set the port the proxy will connect to.
Parameters:
port - is the destination port to connect to.

setDestinationAddress

public void setDestinationAddress(InetAddress addr)
Set the address the proxy will connect to.
Parameters:
addr - is the destination address to connect to.

main

public static void main(String[] argv)
                 throws Exception

Copyright Information