de.trantor.mail.http
Class ConnectionImpl

java.lang.Object
  |
  +--de.trantor.mail.Connection
        |
        +--de.trantor.mail.http.ConnectionImpl

public class ConnectionImpl
extends Connection

Provides a concrete descendent of the abstract "Connection" class that can be used in any J2ME environments. It relies only on HTTP, which is the only protocol that is mandatory in the Generic Connection Framework. The class implements the client side of a TCP-through-HTTP tunnel (which sounds somewhat absurd at first sight, but makes sense in the J2ME scenario). The server part is implemented by the servlet contained in the de.trantor.mail.proxy package.

See Also:
Connection, javax.microedition.io.HttpConnection

Constructor Summary
ConnectionImpl(java.lang.String proxyHost, int proxyPort)
           
 
Method Summary
 void close()
          Closes the connection.
 boolean connected()
          Queries the current status of the connection.
 void open(java.lang.String host, int port, boolean ssl)
          Opens a connection with the given host on the given port.
protected  int read(byte[] buffer, int offset, int count)
          Reads from the socket.
protected  void write(byte[] buffer, int offset, int count)
          Writes to the socket.
 
Methods inherited from class de.trantor.mail.Connection
getDebug, getInstance, receive, send, setDebug
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConnectionImpl

public ConnectionImpl(java.lang.String proxyHost,
                      int proxyPort)
Method Detail

open

public void open(java.lang.String host,
                 int port,
                 boolean ssl)
          throws java.io.IOException
Opens a connection with the given host on the given port.

Specified by:
open in class Connection
java.io.IOException
See Also:
close()

close

public void close()
           throws java.io.IOException
Closes the connection.

Specified by:
close in class Connection
java.io.IOException
See Also:
open(java.lang.String, int, boolean)

read

protected int read(byte[] buffer,
                   int offset,
                   int count)
            throws java.io.IOException
Description copied from class: Connection
Reads from the socket.

Specified by:
read in class Connection
java.io.IOException

write

protected void write(byte[] buffer,
                     int offset,
                     int count)
              throws java.io.IOException
Description copied from class: Connection
Writes to the socket.

Specified by:
write in class Connection
java.io.IOException

connected

public boolean connected()
Description copied from class: Connection
Queries the current status of the connection.

Specified by:
connected in class Connection