Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

initial netty spdy progress

  • Loading branch information...
commit d4fe311ec0e019bfcf77c36a375d13c6fcf23dac 0 parents
@benmmurphy authored
3  .gitignore
@@ -0,0 +1,3 @@
+target/
+project/boot/
+project/target/
21 build.sbt
@@ -0,0 +1,21 @@
+name := "SPDY Test"
+
+version := "1.0"
+
+scalaVersion := "2.9.0"
+
+libraryDependencies += "com.ning" % "async-http-client" % "1.6.4"
+
+libraryDependencies += "io.netty" % "netty" % "3.3.1.Final"
+
+libraryDependencies += "commons-io" % "commons-io" % "2.0.1"
+
+libraryDependencies += "org.slf4j" % "slf4j-api" % "1.6.2"
+
+libraryDependencies += "ch.qos.logback" % "logback-classic" % "0.9.29"
+
+libraryDependencies += "ch.qos.logback" % "logback-core" % "0.9.29"
+
+
+
+
16 src/main/scala/SpdyHandler.scala
@@ -0,0 +1,16 @@
+import org.jboss.netty.channel._
+import org.jboss.netty.handler._
+import org.jboss.netty.handler.codec.spdy._
+import org.slf4j._
+
+class SpdyHandler extends SimpleChannelUpstreamHandler {
+ val logger:Logger = LoggerFactory.getLogger(classOf[SpdyHandler]);
+
+ override def messageReceived(ctx: ChannelHandlerContext, e: MessageEvent) = {
+ val frame = e.getMessage().asInstanceOf[SpdySynStreamFrame]
+ logger.debug("received syn stream", frame)
+ /* we fall off here when we block */
+
+ }
+
+}
16 src/main/scala/SpdyServer.scala
@@ -0,0 +1,16 @@
+import org.jboss.netty.bootstrap._
+import org.jboss.netty.channel.socket.nio._
+import java.net._
+import java.util.concurrent._
+
+
+object SpdyServer {
+ def main(args: Array[String]) {
+ val bootstrap = new ServerBootstrap(new NioServerSocketChannelFactory(
+ Executors.newCachedThreadPool(),
+ Executors.newCachedThreadPool()))
+
+ bootstrap.setPipelineFactory(new SpdyServerPipelineFactory())
+ bootstrap.bind(new InetSocketAddress(4567))
+ }
+}
25 src/main/scala/SpdyServerPipelineFactory.scala
@@ -0,0 +1,25 @@
+import org.jboss.netty.channel._
+import org.jboss.netty.channel.Channels._
+import org.jboss.netty.handler.codec.spdy._
+import org.jboss.netty.handler.ssl._
+import javax.net.ssl.SSLEngine
+
+class SpdyServerPipelineFactory extends ChannelPipelineFactory {
+
+ def createSSLEngine() : SSLEngine = {
+ null
+ }
+
+ def getPipeline() : ChannelPipeline = {
+ val engine = createSSLEngine()
+ val pipe = pipeline()
+
+ pipe.addLast("ssl", new SslHandler(engine))
+ pipe.addLast("decoder", new SpdyFrameDecoder())
+ pipe.addLast("encoder", new SpdyFrameEncoder())
+ pipe.addLast("handler", new SpdySessionHandler(true))
+ pipe.addLast("handler", new SpdyHandler())
+ pipe
+ }
+}
+
Please sign in to comment.
Something went wrong with that request. Please try again.