Author: trustin
Date: Thu Nov  4 08:50:44 2004
New Revision: 56609

Modified:
   incubator/directory/seda/trunk/src/test/org/apache/seda/ProtocolTestCase.java
Log:
Fixed that UDP service entry is not added and UDP port is not bound.

Modified: 
incubator/directory/seda/trunk/src/test/org/apache/seda/ProtocolTestCase.java
==============================================================================
--- 
incubator/directory/seda/trunk/src/test/org/apache/seda/ProtocolTestCase.java   
    (original)
+++ 
incubator/directory/seda/trunk/src/test/org/apache/seda/ProtocolTestCase.java   
    Thu Nov  4 08:50:44 2004
@@ -24,9 +24,11 @@
 import org.apache.seda.listener.AvailablePortFinder;
 import org.apache.seda.listener.ListenerConfig;
 import org.apache.seda.listener.TCPListenerConfig;
+import org.apache.seda.listener.UDPListenerConfig;
 import org.apache.seda.protocol.DefaultInetServicesDatabase;
 import org.apache.seda.protocol.InetServiceEntry;
 import org.apache.seda.protocol.ProtocolProvider;
+import org.apache.seda.protocol.TransportTypeEnum;
 
 
 /**
@@ -45,7 +47,8 @@
     protected ProtocolProvider proto = null;
 
     /** the listener configuration for the protocol */
-    protected ListenerConfig config = null;
+    protected ListenerConfig tcpConfig;
+    protected ListenerConfig udpConfig;
 
     /** the server port number for the test protocol */
     protected int port;
@@ -63,7 +66,7 @@
     protected void tearDown() throws Exception
     {
         super.tearDown();
-        fe.getTCPListenerManager().unbind(config);
+        fe.getTCPListenerManager().unbind(tcpConfig);
         fe.stop();
         fe = null;
     }
@@ -80,11 +83,17 @@
 
         this.port = AvailablePortFinder.getNextAvailable(6666);
 
-        InetServiceEntry srvEntry =
-            new InetServiceEntry(proto.getName(), port, proto);
+        InetServiceEntry srvEntry;
+        
+        srvEntry = new InetServiceEntry(proto.getName(), port, proto, 
TransportTypeEnum.TCP);
         ((DefaultInetServicesDatabase) 
fe.getInetServicesDatabase()).addEntry(srvEntry);
-        config = new TCPListenerConfig(InetAddress.getLocalHost(), srvEntry);
-        fe.getTCPListenerManager().bind(config);
+        tcpConfig = new TCPListenerConfig(InetAddress.getLocalHost(), 
srvEntry);
+        fe.getTCPListenerManager().bind(tcpConfig);
+        
+        srvEntry = new InetServiceEntry(proto.getName(), port, proto, 
TransportTypeEnum.UDP);
+        ((DefaultInetServicesDatabase) 
fe.getInetServicesDatabase()).addEntry(srvEntry);
+        udpConfig = new UDPListenerConfig(InetAddress.getLocalHost(), 
srvEntry);
+        fe.getUDPListenerManager().bind(udpConfig);
     }
     
     public static void assertEquals(byte[] expected, byte[] actual) {

Reply via email to