net.i2p.client
Class ATalk

java.lang.Object
  extended by net.i2p.client.ATalk
All Implemented Interfaces:
java.lang.Runnable, I2PSessionListener

public class ATalk
extends java.lang.Object
implements I2PSessionListener, java.lang.Runnable

ATalk - anonymous talk, demonstrating a trivial I2P usage scenario. Run this class with no arguments for a manual.

Author:
jrandom

Field Summary
static java.lang.String PROP_CONFIG_LOCATION
           
 
Constructor Summary
ATalk(java.lang.String myKeyFile, java.lang.String theirDestFile)
          Construct the talk engine, but don't connect yet
 
Method Summary
 void connect()
          Actually start up the connection to the I2P network.
 void disconnected(I2PSession session)
          required by I2PSessionListener to notify of disconnect
 void errorOccurred(I2PSession session, java.lang.String message, java.lang.Throwable error)
          required by I2PSessionListener to notify of error
static void main(java.lang.String[] args)
          driver
 void messageAvailable(I2PSession session, int msgId, long size)
          I2PSessionListener.messageAvailable requires this method to be called whenever I2P wants to tell the session that a message is available.
 void reportAbuse(I2PSession session, int severity)
          required by I2PSessionListener to notify of abuse
 void run()
          Actual bulk processing of the application, reading in user input, sending messages, and displaying results.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROP_CONFIG_LOCATION

public static final java.lang.String PROP_CONFIG_LOCATION
See Also:
Constant Field Values
Constructor Detail

ATalk

public ATalk(java.lang.String myKeyFile,
             java.lang.String theirDestFile)
Construct the talk engine, but don't connect yet

Method Detail

connect

public void connect()
             throws java.io.IOException,
                    I2PSessionException,
                    DataFormatException
Actually start up the connection to the I2P network. Successful connect does not mean the peer is online or reachable.

Throws:
java.io.IOException - if there is a problem reading in the keys from the files specified
DataFormatException - if the key files are not in the valid format
I2PSessionException - if there is a problem contacting the I2P router

run

public void run()
Actual bulk processing of the application, reading in user input, sending messages, and displaying results. When this function exits, the application is complete.

Specified by:
run in interface java.lang.Runnable

messageAvailable

public void messageAvailable(I2PSession session,
                             int msgId,
                             long size)
I2PSessionListener.messageAvailable requires this method to be called whenever I2P wants to tell the session that a message is available. ATalk always grabs the message immediately and either processes it as a "send file" command (passing it off to handleRecieveFile(..) or simply displays the message to the user.

Specified by:
messageAvailable in interface I2PSessionListener
Parameters:
session - session to notify
msgId - message number available
size - size of the message

main

public static void main(java.lang.String[] args)
driver


disconnected

public void disconnected(I2PSession session)
required by I2PSessionListener to notify of disconnect

Specified by:
disconnected in interface I2PSessionListener

errorOccurred

public void errorOccurred(I2PSession session,
                          java.lang.String message,
                          java.lang.Throwable error)
required by I2PSessionListener to notify of error

Specified by:
errorOccurred in interface I2PSessionListener

reportAbuse

public void reportAbuse(I2PSession session,
                        int severity)
required by I2PSessionListener to notify of abuse

Specified by:
reportAbuse in interface I2PSessionListener
Parameters:
session - session to report abuse to
severity - how bad the abuse is