You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by ch...@apache.org on 2006/09/21 00:37:05 UTC
svn commit: r448380 -
/geronimo/sandbox/gcache/openwire/src/test/java/org/apache/geronimo/openwire/transport/tcp/TcpTransportFactoryTest.java
Author: chirino
Date: Wed Sep 20 15:37:04 2006
New Revision: 448380
URL: http://svn.apache.org/viewvc?view=rev&rev=448380
Log:
Start the transport and just print out the commands the server recives.
Modified:
geronimo/sandbox/gcache/openwire/src/test/java/org/apache/geronimo/openwire/transport/tcp/TcpTransportFactoryTest.java
Modified: geronimo/sandbox/gcache/openwire/src/test/java/org/apache/geronimo/openwire/transport/tcp/TcpTransportFactoryTest.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gcache/openwire/src/test/java/org/apache/geronimo/openwire/transport/tcp/TcpTransportFactoryTest.java?view=diff&rev=448380&r1=448379&r2=448380
==============================================================================
--- geronimo/sandbox/gcache/openwire/src/test/java/org/apache/geronimo/openwire/transport/tcp/TcpTransportFactoryTest.java (original)
+++ geronimo/sandbox/gcache/openwire/src/test/java/org/apache/geronimo/openwire/transport/tcp/TcpTransportFactoryTest.java Wed Sep 20 15:37:04 2006
@@ -17,15 +17,18 @@
*/
package org.apache.geronimo.openwire.transport.tcp;
+import java.io.IOException;
import java.net.URI;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.apache.geronimo.openwire.command.Command;
import org.apache.geronimo.openwire.command.NodeInfo;
import org.apache.geronimo.openwire.transport.DefaultTransportListener;
import org.apache.geronimo.openwire.transport.Transport;
import org.apache.geronimo.openwire.transport.TransportAcceptListener;
import org.apache.geronimo.openwire.transport.TransportFactory;
+import org.apache.geronimo.openwire.transport.TransportListener;
import org.testng.annotations.AfterSuite;
import org.testng.annotations.BeforeSuite;
import org.testng.annotations.Test;
@@ -54,6 +57,24 @@
"this parameter is ignored", new URI(serverURI));
server.setAcceptListener(new TransportAcceptListener () {
public void onAccept(Transport transport) {
+
+ transport.setTransportListener(new TransportListener() {
+ public void onCommand(Command command) {
+ System.out.println("Got: "+command);
+ }
+ public void onException(IOException error) {
+ System.out.println("Got Error: "+error);
+ }
+ public void transportInterupted() {
+ }
+ public void transportResumed() {
+ }});
+
+ try {
+ transport.start();
+ } catch (Exception e) {
+ onAcceptError(e);
+ }
}
public void onAcceptError(Exception error) {
@@ -74,7 +95,7 @@
remoteTransport.start();
localTransport.start();
NodeInfo command = new NodeInfo();
- remoteTransport.oneway(command);
+ remoteTransport.request(command);
log.info("send " + command);
}