public class TcpSink extends AbstractModuleFixture<TcpSink> implements Disposable
label
Constructor and Description |
---|
TcpSink()
Construct a TcpSink with a port selected by @link
AvailableSocketPorts.nextAvailablePort() |
TcpSink(int port)
Create a TcpSink with the provided port
|
TcpSink(java.lang.String host,
int port)
Create a TcpSink with the provided port
|
Modifier and Type | Method and Description |
---|---|
void |
cleanup()
Free up resources that this fixture may have created.
|
byte[] |
getReceivedBytes()
Return the bytes received by the sink
|
TcpSink |
start()
Create a socket and copy received data into a buffer
|
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 TcpSink |
withDefaultPort()
Construct a TcpSink with the default port of 1234
|
static TcpSink |
withDefaults(java.lang.String host)
Construct a TcpSink with the specified host and a default port of 1234
|
label, toString
public TcpSink()
AvailableSocketPorts.nextAvailablePort()
public TcpSink(java.lang.String host, int port)
host
- used to configure the sinkpublic TcpSink(int port)
port
- used to configure the sinkpublic static TcpSink withDefaults(java.lang.String host)
host
- the host where tcp data will be sentpublic static TcpSink withDefaultPort()
public TcpSink start() throws java.io.IOException
java.io.IOException
- socket processing errorspublic byte[] getReceivedBytes() throws java.io.IOException
java.io.IOException
- exception getting bytes from ByteArrayOutputStreampublic void cleanup()
Disposable
cleanup
in interface Disposable
protected java.lang.String toDSL()
AbstractModuleFixture
file --dir=xxxx --name=yyyy
toDSL
in class AbstractModuleFixture<TcpSink>