On Oct 7, 2006, at 12:56 AM, Trustin Lee wrote:
SocketConnector connector = new SocketConnector();connector.setRemoteAddress(new InetSocketAddress("example.com", 8080));connector.setLocalAddress(....); connector.setTcpNoDelay(true); connector.setHandler(...); connector.start(); // connector.stop() will disconnect the session.WDYT?
the one thing that I like about the current API that this "looses" is that the current API allows the Connector's to be like a "factory", since the config/filters can be pre-set on the Connector and clients that use the Connector just have to provide an IoHandler / target address.
of course, the way to solve this is to just make a *ConnectorFactory that wraps this new API. the added bonus is that things like the Handler can be set on the factory as well, so that client code just needs to provide a target IP.
i'd also like to use some interfaces to separate concerns too...
class DefaultSocketConector implements ConfigurableSocketConnector
{
// impls of everything
}
interface ConfigurableSocketConnector extends SocketConnector {
// all of the setters and getters to config, things that pure-
consumers of a connection don't need to fiddle with
}
interface SocketConnector {
// the bare-minimum of methods that consumers of a connection need
to deal with to connect
void setRemoteAddr() void setLocalAddr() void connect(); void close(); } -pete -- [EMAIL PROTECTED] - http://fotap.org/~osi
smime.p7s
Description: S/MIME cryptographic signature
