public abstract class AbstractClientProxyConnector extends java.lang.Object implements StatefulProxyConnector
StatefulProxyConnector
.Modifier and Type | Field and Description |
---|---|
private java.util.List<java.util.concurrent.Callable<java.lang.Void>> |
bufferedCommands |
private static long |
DEFAULT_PROXY_TIMEOUT_MILLIS |
private boolean |
done |
private long |
lastProxyOperationTime |
private java.lang.Object |
lock
Guards
done and bufferedCommands . |
protected java.net.InetSocketAddress |
proxyAddress
The proxy address.
|
protected char[] |
proxyPassword
The password to use for authentication at the proxy.
|
protected java.lang.String |
proxyUser
The user to authenticate at the proxy with.
|
private long |
remainingProxyProtocolTime |
protected java.net.InetSocketAddress |
remoteAddress
The ultimate remote address to connect to.
|
private java.util.concurrent.atomic.AtomicReference<java.lang.Runnable> |
unregister |
TIMEOUT_PROPERTY
Constructor and Description |
---|
AbstractClientProxyConnector(java.net.InetSocketAddress proxyAddress,
java.net.InetSocketAddress remoteAddress,
java.lang.String proxyUser,
char[] proxyPassword)
Creates a new
AbstractClientProxyConnector . |
Modifier and Type | Method and Description |
---|---|
protected void |
adjustTimeout()
Adjusts the timeout calculation to not account of elapsed time since the
last time the timeout was gotten.
|
protected void |
clearPassword()
Clears the proxy password.
|
protected long |
getTimeout()
Obtains the timeout for the whole rest of the proxy connection protocol.
|
protected void |
init(org.apache.sshd.client.session.ClientSession session)
Initializes this instance.
|
void |
runWhenDone(java.util.concurrent.Callable<java.lang.Void> starter)
Runs
command once the proxy connection is established. |
protected void |
setDone(boolean success)
Sets the "done" flag.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
messageReceived
private static final long DEFAULT_PROXY_TIMEOUT_MILLIS
private java.lang.Object lock
done
and bufferedCommands
.private boolean done
private java.util.List<java.util.concurrent.Callable<java.lang.Void>> bufferedCommands
private java.util.concurrent.atomic.AtomicReference<java.lang.Runnable> unregister
private long remainingProxyProtocolTime
private long lastProxyOperationTime
protected final java.net.InetSocketAddress remoteAddress
protected final java.net.InetSocketAddress proxyAddress
protected java.lang.String proxyUser
protected char[] proxyPassword
public AbstractClientProxyConnector(@NonNull java.net.InetSocketAddress proxyAddress, @NonNull java.net.InetSocketAddress remoteAddress, java.lang.String proxyUser, char[] proxyPassword)
AbstractClientProxyConnector
.proxyAddress
- of the proxy server we're connecting toremoteAddress
- of the target server to connect toproxyUser
- to authenticate at the proxy with; may be null
proxyPassword
- to authenticate at the proxy with; may be null
protected void init(org.apache.sshd.client.session.ClientSession session)
session
- to initialize forprotected long getTimeout()
protected void adjustTimeout()
protected void setDone(boolean success) throws java.lang.Exception
success
- whether the connector terminated successfully.java.lang.Exception
- if starting ssh failspublic void runWhenDone(java.util.concurrent.Callable<java.lang.Void> starter) throws java.lang.Exception
StatefulProxyConnector
command
once the proxy connection is established. May be
called multiple times; commands are run sequentially. If the proxy
connection is already established, command
is executed directly
synchronously.runWhenDone
in interface StatefulProxyConnector
starter
- operation to runjava.lang.Exception
- if the operation is run synchronously and throws an exceptionprotected void clearPassword()