@MessageConnectorSummary(info="Connects to some host using TCP/IP client socket.", addressFormat="<host>:<port>") public class ClientSocketConnector extends AbstractMessageConnector implements SocketHandler.CloseListener, ClientSocketConnectorMBean
ClientSocketConnector
handles standard client socket using blocking API.AbstractMessageConnector.Joinable
Modifier and Type | Field and Description |
---|---|
protected com.devexperts.qd.qtp.socket.SocketHandler |
handler |
protected String |
host |
protected int |
port |
protected String |
proxyHost |
protected int |
proxyPort |
protected com.devexperts.qd.qtp.socket.ClientSocketSource |
socketSource |
protected TrustManager |
trustManager |
protected boolean |
useTls |
log
Constructor and Description |
---|
ClientSocketConnector(com.devexperts.connector.proto.ApplicationConnectionFactory factory,
String host,
int port)
Creates new client socket connector.
|
ClientSocketConnector(MessageAdapter.Factory factory,
String host,
int port)
Deprecated.
|
Modifier and Type | Method and Description |
---|---|
String |
getAddress()
Address string of connector.
|
int |
getConnectionCount()
Number of established connections
|
String |
getCurrentHost()
Current IP address of connection when connecting to the cluster
|
int |
getCurrentPort() |
String |
getHost()
Host name of IP address
|
int |
getPort()
TCP/IP port
|
String |
getProxyHost()
HTTP proxy host name
|
int |
getProxyPort()
HTTP proxy port
|
MessageConnectorState |
getState()
State of connector.
|
boolean |
getTls()
Deprecated.
|
TrustManager |
getTrustManager()
Deprecated.
|
void |
handlerClosed(com.devexperts.qd.qtp.socket.SocketHandler handler) |
boolean |
isActive()
True when connector is active (started).
|
com.devexperts.transport.stats.EndpointStats |
retrieveCompleteEndpointStats()
Retrieves endpoint statistics for this message connector since its creation
|
void |
setHost(String host)
Changes connection host string and restarts connector
if new host string is different from the old one and the connector was running.
|
void |
setPort(int port)
Changes connection port and restarts connector
if new port is different from the old one and the connector was running.
|
void |
setProxyHost(String proxyHost) |
void |
setProxyPort(int proxyPort) |
void |
setStats(QDStats stats)
Sets stats for this connector.
|
void |
setTls(boolean useTls)
Deprecated.
|
void |
setTrustManager(TrustManager trustManager)
Deprecated.
|
void |
start()
Starts connector (connection is immediately established).
|
protected AbstractMessageConnector.Joinable |
stopImpl() |
addClosedConnectionStats, addMessageConnectorListener, getClosedConnectionCount, getEndpointStats, getFactory, getLogging, getName, getPassword, getReconnectDelay, getStats, getThreadPriority, getUser, handlerClosed, notifyMessageConnectorListeners, reconfigure, removeMessageConnectorListener, resetEndpointStats, restart, setFactory, setName, setPassword, setReconnectDelay, setThreadPriority, setUser, stop, stopAndWait, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getEndpointStats, getName, getPassword, getReconnectDelay, getThreadPriority, getUser, resetEndpointStats, restart, setName, setPassword, setReconnectDelay, setThreadPriority, setUser, stop
awaitProcessed
protected String host
protected int port
protected String proxyHost
protected int proxyPort
protected boolean useTls
protected TrustManager trustManager
protected volatile com.devexperts.qd.qtp.socket.SocketHandler handler
protected com.devexperts.qd.qtp.socket.ClientSocketSource socketSource
@Deprecated public ClientSocketConnector(MessageAdapter.Factory factory, String host, int port)
ClientSocketConnector(ApplicationConnectionFactory, String, int)
factory
- message adapter factory to usehost
- host to connect toport
- TCP port to connect toNullPointerException
- if factory
or host
is null
public ClientSocketConnector(com.devexperts.connector.proto.ApplicationConnectionFactory factory, String host, int port)
factory
- application connection factory factory to usehost
- host to connect toport
- TCP port to connect toNullPointerException
- if factory
or host
is null
public String getAddress()
MessageConnectorMBean
getAddress
in interface MessageConnectorMBean
public String getHost()
ClientSocketConnectorMBean
getHost
in interface ClientSocketConnectorMBean
public void setHost(String host)
setHost
in interface ClientSocketConnectorMBean
public int getPort()
ClientSocketConnectorMBean
getPort
in interface ClientSocketConnectorMBean
public void setPort(int port)
setPort
in interface ClientSocketConnectorMBean
public String getProxyHost()
ClientSocketConnectorMBean
getProxyHost
in interface ClientSocketConnectorMBean
public void setProxyHost(String proxyHost)
setProxyHost
in interface ClientSocketConnectorMBean
public int getProxyPort()
ClientSocketConnectorMBean
getProxyPort
in interface ClientSocketConnectorMBean
public void setProxyPort(int proxyPort)
setProxyPort
in interface ClientSocketConnectorMBean
@Deprecated public boolean getTls()
@Deprecated public void setTls(boolean useTls)
@Deprecated public TrustManager getTrustManager()
@Deprecated public void setTrustManager(TrustManager trustManager)
trust manager
to be used by SSLSocketFactory
.
This property has effect only when the connector is configured to use TLS
.trustManager
- trust manager to use instead of the default one, or null
in order to use default one.public void setStats(QDStats stats)
QDStats.SType#CLIENT_SOCKET_CONNECTOR
or
a suitable substitute. This method may be invoked only once.setStats
in interface MessageConnector
setStats
in class AbstractMessageConnector
IllegalStateException
- if already set.public boolean isActive()
MessageConnectorMBean
isActive
in interface MessageConnectorMBean
public MessageConnectorState getState()
MessageConnectorMBean
getState
in interface MessageConnectorMBean
public int getConnectionCount()
MessageConnectorMBean
getConnectionCount
in interface MessageConnectorMBean
public com.devexperts.transport.stats.EndpointStats retrieveCompleteEndpointStats()
MessageConnectorMBean
retrieveCompleteEndpointStats
in interface MessageConnectorMBean
retrieveCompleteEndpointStats
in class AbstractMessageConnector
public void start()
MessageConnectorMBean
start
in interface MessageConnectorMBean
start
in class AbstractMessageConnector
protected AbstractMessageConnector.Joinable stopImpl()
stopImpl
in class AbstractMessageConnector
public void handlerClosed(com.devexperts.qd.qtp.socket.SocketHandler handler)
handlerClosed
in interface SocketHandler.CloseListener
public String getCurrentHost()
ClientSocketConnectorMBean
getCurrentHost
in interface ClientSocketConnectorMBean
public int getCurrentPort()
getCurrentPort
in interface ClientSocketConnectorMBean
Copyright © 2002-2019 Devexperts LLC. All Rights Reserved.