Permalink
Browse files

test is a bit safer if/when it breaks

  • Loading branch information...
1 parent 8646866 commit 936d9537f02524af6aa2736615f10439944dbb02 Nick Kallen committed Jan 7, 2011
@@ -5,7 +5,7 @@ import scala.collection.JavaConversions._
import java.util.concurrent.ConcurrentHashMap
-import com.twitter.util.{Duration, Time}
+import com.twitter.util.Duration
import com.twitter.util.TimeConversions._
// TODO: do we want a decaying stat?
@@ -5,12 +5,13 @@ import org.specs.Specification
import org.jboss.netty.bootstrap.ClientBootstrap
import org.jboss.netty.channel._
-import com.twitter.util.{Promise, Return}
-
import com.twitter.finagle.builder.ClientBuilder
import com.twitter.finagle.util.Conversions._
import com.twitter.finagle.util.Ok
+import com.twitter.util.CountDownLatch
+import com.twitter.conversions.time._
+
/**
* Here we test a number of assumptions we are making of Netty. This
* is all stuff that's verified by examination of the Netty codebase,
@@ -38,19 +39,19 @@ object NettyAssumptionsSpec extends Specification {
})
bootstrap.setPipeline(pipeline)
- val latch = new Promise[Unit]
+ val latch = new CountDownLatch(1)
bootstrap.connect(server.addr) {
case Ok(channel) =>
channel.isOpen must beTrue
Channels.close(channel)
channel.isOpen must beFalse
- latch() = Return(())
+ latch.countDown()
case _ =>
throw new Exception("Failed to connect to the expected socket.")
}
- latch()
+ latch.await(1.second) must beTrue
}
}
}

0 comments on commit 936d953

Please sign in to comment.