Commits

Hector Miuler Malpica Gallegos committed 8595df3

Cambios:
* update MockSMTP
* update de .hgignore
* add plugins for generate conf for idea
* add Main and Constant

  • Participants
  • Parent commits 5204853

Comments (0)

Files changed (5)

 project/target
 target
+\.idea
+.*\.iml

project/plugins.sbt

+
+resolvers += "Sonatype snapshots" at "http://oss.sonatype.org/content/repositories/snapshots/"
+
+addSbtPlugin("com.github.mpeltonen" % "sbt-idea" % "1.2.0-SNAPSHOT")
+

src/main/scala/com/miuler/mocksmtp/Constant.scala

+package com.miuler.mocksmtp
+
+/**
+ * Created with IntelliJ IDEA.
+ * User: miuler
+ * Date: 17/09/12
+ * Time: 03:01 PM
+ * To change this template use File | Settings | File Templates.
+ */
+object Constant {
+  val PORT = 80
+}

src/main/scala/com/miuler/mocksmtp/Main.scala

+package com.miuler.mocksmtp
+
+/**
+ * Created with IntelliJ IDEA.
+ * User: miuler
+ * Date: 17/09/12
+ * Time: 02:44 PM
+ * To change this template use File | Settings | File Templates.
+ */
+object Main {
+
+  def main(argv : Array[String]) {
+    var mockSMTP = new MockSMTP(Array("a1", "b2", "c3"))
+  }
+
+}

src/main/scala/com/miuler/mocksmtp/MockSMTP.scala

 package com.miuler.mocksmtp
 
+import java.util.concurrent.Executors
+import org.jboss.netty.channel.socket.nio.NioClientSocketChannelFactory
+import org.jboss.netty.channel.{ChannelPipeline, ChannelPipelineFactory, ChannelFactory}
+import org.jboss.netty.bootstrap.ClientBootstrap
+import org.jboss.netty.handler.codec.frame.{Delimiters, DelimiterBasedFrameDecoder}
+
+
 /**
  * Created with IntelliJ IDEA.
  * User: miuler
  * Time: 08:16 PM
  * To change this template use File | Settings | File Templates.
  */
-class MockSMTP {
+class MockSMTP(id: String, serverId: String) {
 
-  def main(argv : Array[String]) {
-    println("Hola Mundo")
+
+  def initSMTP() {
+    val bossPoll = Executors.newCachedThreadPool()
+    val workerPoll = Executors.newCachedThreadPool()
+    val factory = new NioClientSocketChannelFactory(bossPoll, workerPoll)
+    val frameDecoder = new DelimiterBasedFrameDecoder(Integer.MAX_VALUE, Delimiters.lineDelimiter():_*)
+    val bootstrap = new ClientBootstrap(factory)
+
+    bootstrap.setPipelineFactory(new ChannelPipelineFactory {
+
+      def getPipeline: ChannelPipeline = {
+        //val byteCounter = new ByteCounter("+++ SERVER-COUNTER :: ")
+        //val messageCounter = new MessageCounter("+++ SERVER-MSGCOUNTER :: ")
+        //new ClientHandshakeHandler(id, serverId, 5000)
+      }
+
+    })
+
   }
 
+
 }