super(socketChannel, sslContext, true, 1500, 15000, 1000);
// establish the following output chain:
// stringToByteBuffer -> byteBufferToArray -> sslOutput -> channelWriter
StringToByteBufferTransformer stringOutTransformer =
new StringToByteBufferTransformer();
stringOutTransformer.setNextForwarder(byteBufferToArrayTransformer);
// establish the following input chain:
// channelReader -> sslInput -> byteBufferToString -> sslEchoClient
ByteBufferToStringTransformer toStringTransformer =
new ByteBufferToStringTransformer();
sslInputForwarder.setNextForwarder(toStringTransformer);
toStringTransformer.setNextForwarder(new SSLEchoClientTransformer());
// start NIO Framework
Dispatcher dispatcher = new Dispatcher();
dispatcher.start();
dispatcher.registerChannel(socketChannel, this);
// send all user input to echo server
System.out.println("SSLEchoClient is running...");
InputStreamReader reader = new InputStreamReader(System.in);
BufferedReader stdIn = new BufferedReader(reader);
while (true) {
System.out.print("Your input: ");
String userInput = stdIn.readLine();
if (userInput.length() == 0) {
continue;
}
System.out.println("sending \"" + userInput + "\"");
stringOutTransformer.forward(userInput);
// wait until we get an echo from the server...
lock.lock();
try {
inputArrived.await();
} catch (InterruptedException ex) {