Class TcpClient
- java.lang.Object
-
- io.servicetalk.tcp.netty.internal.TcpClient
-
public final class TcpClient extends java.lang.ObjectA utility to create a TCP clients for tests.
-
-
Constructor Summary
Constructors Constructor Description TcpClient(TcpClientConfig config, TransportObserver observer)New instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ReadOnlyTcpClientConfigconfig()Returns configuration for this client.Single<NettyConnection<Buffer,Buffer>>connect(ExecutionContext executionContext, java.net.SocketAddress address)Connect to the passedaddress.NettyConnection<Buffer,Buffer>connectBlocking(ExecutionContext executionContext, java.net.SocketAddress address)Connect and await for the connection.NettyConnection<Buffer,Buffer>connectWithFdBlocking(ExecutionContext executionContext, java.net.SocketAddress address)Connect using aFileDescriptorSocketAddressand await for the connection.
-
-
-
Constructor Detail
-
TcpClient
public TcpClient(TcpClientConfig config, TransportObserver observer)
New instance.- Parameters:
config- for the client.observer-TransportObserverfor the newly created connection.
-
-
Method Detail
-
connectBlocking
public NettyConnection<Buffer,Buffer> connectBlocking(ExecutionContext executionContext, java.net.SocketAddress address) throws java.util.concurrent.ExecutionException, java.lang.InterruptedException
Connect and await for the connection.- Parameters:
executionContext-ExecutionContextto use for the connections.address- to connect.- Returns:
- New
NettyConnection. - Throws:
java.util.concurrent.ExecutionException- If connect failed.java.lang.InterruptedException- If interrupted while waiting for connect to complete.
-
connect
public Single<NettyConnection<Buffer,Buffer>> connect(ExecutionContext executionContext, java.net.SocketAddress address)
Connect to the passedaddress.- Parameters:
executionContext-ExecutionContextto use for the connections.address- to connect.- Returns:
- New
NettyConnection.
-
connectWithFdBlocking
public NettyConnection<Buffer,Buffer> connectWithFdBlocking(ExecutionContext executionContext, java.net.SocketAddress address) throws java.util.concurrent.ExecutionException, java.lang.InterruptedException
Connect using aFileDescriptorSocketAddressand await for the connection.- Parameters:
executionContext-ExecutionContextto use for the connections.address- to connect.- Returns:
- New
NettyConnection. - Throws:
java.util.concurrent.ExecutionException- If connect failed.java.lang.InterruptedException- If interrupted while waiting for connect to complete.
-
config
public ReadOnlyTcpClientConfig config()
Returns configuration for this client.- Returns:
ReadOnlyTcpClientConfigfor this client.
-
-