use of streamer.BaseElement in project cloudstack by apache.
the class AprSocketWrapperImpl method main.
/**
* Example.
*/
public static void main(String[] args) {
try {
System.setProperty("streamer.Link.debug", "true");
System.setProperty("streamer.Element.debug", "true");
System.setProperty("rdpclient.MockServer.debug", "true");
Pipeline pipeline = new PipelineImpl("echo client");
AprSocketWrapperImpl socketWrapper = new AprSocketWrapperImpl("socket", null);
pipeline.add(socketWrapper);
pipeline.add(new BaseElement("echo"));
// To decouple input and output
pipeline.add(new Queue("queue"));
pipeline.link("socket", "echo", "queue", "socket");
final byte[] mockData = new byte[] { 0x01, 0x02, 0x03 };
MockServer server = new MockServer(new Packet[] { new Packet("Server hello") {
{
type = SERVER;
data = mockData;
}
}, new Packet("Client hello") {
{
type = CLIENT;
data = mockData;
}
}, new Packet("Server hello") {
{
type = SERVER;
data = mockData;
}
}, new Packet("Client hello") {
{
type = CLIENT;
data = mockData;
}
} });
server.start();
InetSocketAddress address = server.getAddress();
socketWrapper.connect(address);
} catch (Exception e) {
e.printStackTrace(System.err);
}
}
Aggregations