public class TcpSource extends AbstractModuleFixture<TcpSource>
| Modifier and Type | Field and Description |
|---|---|
protected int |
port |
label| Constructor and Description |
|---|
TcpSource()
Construct a new TcpSource with the loopback address for host and using a port selected by @link
AvailableSocketPorts.nextAvailablePort() |
TcpSource(java.lang.String host)
Construct a new TcpSource with the provided host and using a port selected by @link
AvailableSocketPorts.nextAvailablePort() |
TcpSource(java.lang.String host,
int port)
Construct a new TcpSource with the provided host and port
|
| Modifier and Type | Method and Description |
|---|---|
TcpSource |
ensureReady()
Ensure that the TcpSource socket is available by polling it for up to 2 seconds
|
void |
sendBytes(byte[] bytes)
Send the specified types to the host and and port of the TCP source.
|
protected java.lang.String |
toDSL()
Returns a representation of the module suitable for inclusion in a stream definition, e.g.
file --dir=xxxx --name=yyyy |
static TcpSource |
withDefaultPort(java.lang.String host)
Construct a new TcpSource using the provided host and the default port of 1234
|
static TcpSource |
withDefaults()
Construct a new TcpSource using the default host of localhost and port of 1234
|
label, toStringpublic TcpSource()
AvailableSocketPorts.nextAvailablePort()public TcpSource(java.lang.String host)
AvailableSocketPorts.nextAvailablePort()host - the host to connect topublic TcpSource(java.lang.String host,
int port)
host - host to connect toport - port to connect topublic static TcpSource withDefaults()
public static TcpSource withDefaultPort(java.lang.String host)
host - host to connect toprotected java.lang.String toDSL()
AbstractModuleFixturefile --dir=xxxx --name=yyyytoDSL in class AbstractModuleFixture<TcpSource>public TcpSource ensureReady()
java.lang.IllegalStateException - if can not connect in 2 seconds.public void sendBytes(byte[] bytes)
bytes - data to send