Top Description Fields Constructors Methods
org.eclipse.jgit.internal.transport.sshd.proxy

public abstract Class AbstractClientProxyConnector

extends Object
implements StatefulProxyConnector
Class Inheritance
All Implemented Interfaces
org.eclipse.jgit.internal.transport.sshd.proxy.StatefulProxyConnector, org.apache.sshd.client.session.ClientProxyConnector
Known Direct Subclasses
org.eclipse.jgit.internal.transport.sshd.proxy.HttpClientConnector, org.eclipse.jgit.internal.transport.sshd.proxy.Socks5ClientConnector
Imports
java.net.InetSocketAddress, java.util.ArrayList, .Arrays, .List, java.util.concurrent.Callable, .TimeUnit, java.util.concurrent.atomic.AtomicReference, org.apache.sshd.client.session.ClientSession, org.eclipse.jgit.annotations.NonNull, org.eclipse.jgit.internal.transport.sshd.JGitClientSession

Basic common functionality for a StatefulProxyConnector.

Field Summary

Modifier and TypeField and Description
private List<Callable<Void>>
private static final long
private boolean
private long
private final Object
protected final InetSocketAddress
proxyAddress

The proxy address.

protected char[]
proxyPassword

The password to use for authentication at the proxy.

protected String
proxyUser

The user to authenticate at the proxy with.

private long
protected final InetSocketAddress
remoteAddress

The ultimate remote address to connect to.

private AtomicReference<Runnable>

Constructor Summary

AccessConstructor and Description
public
AbstractClientProxyConnector(InetSocketAddress
of the proxy server we're connecting to
proxyAddress
,
InetSocketAddress
of the target server to connect to
remoteAddress
,
String
to authenticate at the proxy with; may be null
proxyUser
,
char[]
to authenticate at the proxy with; may be null
proxyPassword
)

Creates a new AbstractClientProxyConnector.

Method Summary

Modifier and TypeMethod 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

Returns:

the timeout in milliseconds, always > 0L
getTimeout
()

Obtains the timeout for the whole rest of the proxy connection protocol.

protected void
init(ClientSession
to initialize for
session
)

Initializes this instance.

public void
runWhenDone(Callable<Void>
operation to run
starter
)

Implements org.eclipse.jgit.internal.transport.sshd.proxy.StatefulProxyConnector.runWhenDone.

Runs command once the proxy connection is established.

protected void
setDone(boolean
whether the connector terminated successfully.
success
)

Sets the "done" flag.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

bufferedCommandsback to summary
private List<Callable<Void>> bufferedCommands
DEFAULT_PROXY_TIMEOUT_NANOSback to summary
private static final long DEFAULT_PROXY_TIMEOUT_NANOS
doneback to summary
private boolean done
lastProxyOperationTimeback to summary
private long lastProxyOperationTime
lockback to summary
private final Object lock

Guards done and bufferedCommands.

proxyAddressback to summary
protected final InetSocketAddress proxyAddress

The proxy address.

proxyPasswordback to summary
protected char[] proxyPassword

The password to use for authentication at the proxy.

proxyUserback to summary
protected String proxyUser

The user to authenticate at the proxy with.

remainingProxyProtocolTimeback to summary
private long remainingProxyProtocolTime
remoteAddressback to summary
protected final InetSocketAddress remoteAddress

The ultimate remote address to connect to.

unregisterback to summary
private AtomicReference<Runnable> unregister

Constructor Detail

AbstractClientProxyConnectorback to summary
public AbstractClientProxyConnector(InetSocketAddress proxyAddress, InetSocketAddress remoteAddress, String proxyUser, char[] proxyPassword)

Creates a new AbstractClientProxyConnector.

Parameters
proxyAddress:InetSocketAddress

of the proxy server we're connecting to

remoteAddress:InetSocketAddress

of the target server to connect to

proxyUser:String

to authenticate at the proxy with; may be null

proxyPassword:char[]

to authenticate at the proxy with; may be null

Method Detail

adjustTimeoutback to summary
protected void adjustTimeout()

Adjusts the timeout calculation to not account of elapsed time since the last time the timeout was gotten. Can be used for instance to ignore time spent in user dialogs be counted against the overall proxy connection protocol timeout.

clearPasswordback to summary
protected void clearPassword()

Clears the proxy password.

getTimeoutback to summary
protected long getTimeout()

Obtains the timeout for the whole rest of the proxy connection protocol.

Returns:long

the timeout in milliseconds, always > 0L

initback to summary
protected void init(ClientSession session)

Initializes this instance. Installs itself as proxy handler on the session.

Parameters
session:ClientSession

to initialize for

runWhenDoneback to summary
public void runWhenDone(Callable<Void> starter) throws Exception

Implements org.eclipse.jgit.internal.transport.sshd.proxy.StatefulProxyConnector.runWhenDone.

Doc from org.eclipse.jgit.internal.transport.sshd.proxy.StatefulProxyConnector.runWhenDone.

Runs 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.

Parameters
starter:Callable<Void>

operation to run

Annotations
@Override
Exceptions
Exception:
if the operation is run synchronously and throws an exception
setDoneback to summary
protected void setDone(boolean success) throws Exception

Sets the "done" flag.

Parameters
success:boolean

whether the connector terminated successfully.

Exceptions
Exception:
if starting ssh fails