Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit d4fe311
Showing
5 changed files
with
81 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
target/ | ||
project/boot/ | ||
project/target/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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" | ||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 */ | ||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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)) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
} | ||
} | ||
|