Commits

Hector Miuler Malpica Gallegos  committed 027df39

simplificando el obtener un string del buffer y agregando una respuesta a la peticion

  • Participants
  • Parent commits 0de00ed

Comments (0)

Files changed (1)

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

 import io.netty.channel.socket.SocketChannel
 import io.netty.buffer.ByteBuf
 import io.netty.util.CharsetUtil
+import io.netty.util.CharsetUtil.UTF_8
 
 /**
  * Created with IntelliJ IDEA.
 
     class ChannelInboundHandlerBasic extends ChannelInboundByteHandlerAdapter {
       def inboundBufferUpdated(ctx: ChannelHandlerContext, in: ByteBuf) {
-        val decoder = CharsetUtil.getDecoder(CharsetUtil.UTF_8)
-        val instr = decoder.decode(in.nioBuffer())
-        log.debug("mensage: \n{}", instr)
+        log.debug("mensage: \n{}", in.toString(UTF_8))
+        ctx.write(in)
         in.clear()
       }
     }
 
-//    class ChannelOutboundHandlerBasic extends ChannelOutboundByteHandlerAdapter {
-//    }
-
     log.debug("new server")
     server = new ServerBootstrap()
       .group(new NioEventLoopGroup())