public abstract class AbstractSimpleClientSessionCreator extends AbstractSimpleClient implements ClientSessionCreator
Modifier and Type | Field and Description |
---|---|
private long |
authenticateTimeout |
private long |
connectTimeout |
log
DEFAULT_AUTHENTICATION_TIMEOUT, DEFAULT_CONNECT_TIMEOUT, DEFAULT_PORT
Modifier | Constructor and Description |
---|---|
protected |
AbstractSimpleClientSessionCreator() |
protected |
AbstractSimpleClientSessionCreator(long connTimeout,
long authTimeout) |
Modifier and Type | Method and Description |
---|---|
protected ClientSession |
authSession(ClientSession clientSession) |
protected ClientSession |
authSession(ConnectFuture future,
java.security.KeyPair identity) |
protected ClientSession |
authSession(ConnectFuture future,
java.lang.String password) |
long |
getAuthenticationTimeout() |
long |
getConnectTimeout() |
protected ClientSession |
loginSession(ConnectFuture future,
java.security.KeyPair identity) |
protected ClientSession |
loginSession(ConnectFuture future,
java.lang.String password) |
ClientSession |
sessionLogin(java.net.SocketAddress target,
java.lang.String username,
java.security.KeyPair identity)
Creates a session and logs in using the provided credentials
|
ClientSession |
sessionLogin(java.net.SocketAddress target,
java.lang.String username,
java.lang.String password)
Creates a session and logs in using the provided credentials
|
void |
setAuthenticationTimeout(long timeout) |
void |
setConnectTimeout(long timeout) |
static SimpleClient |
wrap(ClientSessionCreator creator,
java.nio.channels.Channel channel)
Wraps an existing
ClientSessionCreator into a SimpleClient |
getSimplifiedLogger
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
connect, connect, connect
sessionLogin, sessionLogin, sessionLogin, sessionLogin, sessionLogin, sessionLogin, sessionLogin, sessionLogin
private long connectTimeout
private long authenticateTimeout
protected AbstractSimpleClientSessionCreator()
protected AbstractSimpleClientSessionCreator(long connTimeout, long authTimeout)
public long getConnectTimeout()
getConnectTimeout
in interface SimpleClientConfigurator
public void setConnectTimeout(long timeout)
setConnectTimeout
in interface SimpleClientConfigurator
timeout
- Requested connect timeout (msec.) - always positivepublic long getAuthenticationTimeout()
getAuthenticationTimeout
in interface SimpleClientConfigurator
public void setAuthenticationTimeout(long timeout)
setAuthenticationTimeout
in interface SimpleClientConfigurator
timeout
- Requested authentication timeout (msec.) - always positivepublic ClientSession sessionLogin(java.net.SocketAddress target, java.lang.String username, java.lang.String password) throws java.io.IOException
SimpleSessionClient
sessionLogin
in interface SimpleSessionClient
target
- The target SocketAddress
username
- Usernamepassword
- PasswordClientSession
java.io.IOException
- If failed to login or authenticatepublic ClientSession sessionLogin(java.net.SocketAddress target, java.lang.String username, java.security.KeyPair identity) throws java.io.IOException
SimpleSessionClient
sessionLogin
in interface SimpleSessionClient
target
- The target SocketAddress
username
- Usernameidentity
- The KeyPair
identityClientSession
java.io.IOException
- If failed to login or authenticateprotected ClientSession loginSession(ConnectFuture future, java.lang.String password) throws java.io.IOException
java.io.IOException
protected ClientSession loginSession(ConnectFuture future, java.security.KeyPair identity) throws java.io.IOException
java.io.IOException
protected ClientSession authSession(ConnectFuture future, java.lang.String password) throws java.io.IOException
java.io.IOException
protected ClientSession authSession(ConnectFuture future, java.security.KeyPair identity) throws java.io.IOException
java.io.IOException
protected ClientSession authSession(ClientSession clientSession) throws java.io.IOException
java.io.IOException
public static SimpleClient wrap(ClientSessionCreator creator, java.nio.channels.Channel channel)
ClientSessionCreator
into a SimpleClient
creator
- The ClientSessionCreator
- never null
channel
- The Channel
representing the creator for
relaying Channel.isOpen()
and Channel.close()
callsSimpleClient
wrapper. Note: closing the wrapper
also closes the underlying sessions creator.