diff options
Diffstat (limited to 'src/main/scala/com/tylerstonge/honeypot/http/HttpListener.scala')
-rw-r--r-- | src/main/scala/com/tylerstonge/honeypot/http/HttpListener.scala | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/main/scala/com/tylerstonge/honeypot/http/HttpListener.scala b/src/main/scala/com/tylerstonge/honeypot/http/HttpListener.scala new file mode 100644 index 0000000..edd2b01 --- /dev/null +++ b/src/main/scala/com/tylerstonge/honeypot/http/HttpListener.scala @@ -0,0 +1,28 @@ +package com.tylerstonge.honeypot.http + +import java.net.InetSocketAddress + +import akka.actor.{Actor, Props} +import akka.event.Logging +import akka.io.Tcp._ +import akka.io.{IO, Tcp} +import com.tylerstonge.honeypot.SimplisticHandler + + +class HttpListener extends Actor { + val log = Logging(context.system, this) + + import context.system + + IO(Tcp) ! Bind(self, new InetSocketAddress("localhost", 7333)) + + override def receive: Receive = { + case b@Bound(localAddress) => context.parent ! b + case CommandFailed(_: Bind) => context.stop(self) + case c@Connected(remote, local) => + val handler = context.actorOf(Props[SimplisticHandler]) + val connection = sender() + connection ! Register(handler) + } + +}
\ No newline at end of file |