1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2025-12-26 20:15:26 -05:00

test case for passive connection

This commit is contained in:
v2ray
2016-08-20 09:12:44 +02:00
parent 2268f3d1bc
commit 7a1bdfcf00
4 changed files with 80 additions and 1 deletions

View File

@@ -10,6 +10,7 @@ import (
type Server struct {
Port v2net.Port
MsgProcessor func(msg []byte) []byte
SendFirst []byte
accepting bool
listener *net.TCPListener
}
@@ -44,6 +45,9 @@ func (server *Server) acceptConnections(listener *net.TCPListener) {
}
func (server *Server) handleConnection(conn net.Conn) {
if len(server.SendFirst) > 0 {
conn.Write(server.SendFirst)
}
request := make([]byte, 4096)
for true {
nBytes, err := conn.Read(request)