You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by ni...@apache.org on 2006/01/19 21:05:13 UTC

svn commit: r370589 - in /directory/trunks/mina/examples/src/test/java/org/apache/mina/examples/echoserver: AcceptorTest.java ConnectorTest.java

Author: niklas
Date: Thu Jan 19 12:05:05 2006
New Revision: 370589

URL: http://svn.apache.org/viewcvs?rev=370589&view=rev
Log:
DIRMINA-159. Replaced any use of InetAddress.getLocalHost() with "localhost"
or similar to allow the tests to run even if the current host's hostname doesn't 
map to an IP address.


Modified:
    directory/trunks/mina/examples/src/test/java/org/apache/mina/examples/echoserver/AcceptorTest.java
    directory/trunks/mina/examples/src/test/java/org/apache/mina/examples/echoserver/ConnectorTest.java

Modified: directory/trunks/mina/examples/src/test/java/org/apache/mina/examples/echoserver/AcceptorTest.java
URL: http://svn.apache.org/viewcvs/directory/trunks/mina/examples/src/test/java/org/apache/mina/examples/echoserver/AcceptorTest.java?rev=370589&r1=370588&r2=370589&view=diff
==============================================================================
--- directory/trunks/mina/examples/src/test/java/org/apache/mina/examples/echoserver/AcceptorTest.java (original)
+++ directory/trunks/mina/examples/src/test/java/org/apache/mina/examples/echoserver/AcceptorTest.java Thu Jan 19 12:05:05 2006
@@ -116,7 +116,7 @@
     
     private void testTCP0( EchoTCPClient client ) throws Exception
     {
-        client.connect( InetAddress.getLocalHost(), port );
+        client.connect( "localhost", port );
         byte[] writeBuf = new byte[ 16 ];
 
         for( int i = 0; i < 10; i ++ )
@@ -177,7 +177,7 @@
         {
             fillWriteBuffer( writeBuf, i );
             client.send( writeBuf, writeBuf.length, InetAddress
-                    .getLocalHost(), port );
+                    .getByName( null ), port );
 
             assertEquals( readBuf.length, client.receive( readBuf,
                     readBuf.length ) );

Modified: directory/trunks/mina/examples/src/test/java/org/apache/mina/examples/echoserver/ConnectorTest.java
URL: http://svn.apache.org/viewcvs/directory/trunks/mina/examples/src/test/java/org/apache/mina/examples/echoserver/ConnectorTest.java?rev=370589&r1=370588&r2=370589&view=diff
==============================================================================
--- directory/trunks/mina/examples/src/test/java/org/apache/mina/examples/echoserver/ConnectorTest.java (original)
+++ directory/trunks/mina/examples/src/test/java/org/apache/mina/examples/echoserver/ConnectorTest.java Thu Jan 19 12:05:05 2006
@@ -19,7 +19,6 @@
 package org.apache.mina.examples.echoserver;
 
 import java.net.BindException;
-import java.net.InetAddress;
 import java.net.InetSocketAddress;
 
 import junit.framework.Assert;
@@ -105,7 +104,7 @@
         if( !useLocalAddress )
         {
             ConnectFuture future = connector.connect(
-                    new InetSocketAddress( InetAddress.getLocalHost(), port ),
+                    new InetSocketAddress( "localhost", port ),
                     handler );
             future.join();
             session = future.getSession();
@@ -119,7 +118,7 @@
                 try
                 {
                     ConnectFuture future = connector.connect(
-                            new InetSocketAddress( InetAddress.getLocalHost(), port ),
+                            new InetSocketAddress( "localhost", port ),
                             new InetSocketAddress( clientPort ),
                             handler );
                     future.join();