summaryrefslogtreecommitdiff
path: root/socket_factory_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'socket_factory_test.go')
-rw-r--r--socket_factory_test.go25
1 files changed, 25 insertions, 0 deletions
diff --git a/socket_factory_test.go b/socket_factory_test.go
index 3bb60ab0..f6b1350c 100644
--- a/socket_factory_test.go
+++ b/socket_factory_test.go
@@ -32,6 +32,31 @@ func Test_Tcp_Start(t *testing.T) {
w.Stop()
}
+func Test_Tcp_StartCloseFactory(t *testing.T) {
+ time.Sleep(time.Millisecond * 10) // to ensure free socket
+
+ ls, err := net.Listen("tcp", "localhost:9007")
+ if assert.NoError(t, err) {
+ } else {
+ t.Skip("socket is busy")
+ }
+
+ cmd := exec.Command("php", "php-src/tests/client.php", "echo", "tcp")
+
+ f := NewSocketFactory(ls, time.Minute)
+ defer f.Close()
+
+ w, err := f.SpawnWorker(cmd)
+ assert.NoError(t, err)
+ assert.NotNil(t, w)
+
+ go func() {
+ assert.NoError(t, w.Wait())
+ }()
+
+ w.Stop()
+}
+
func Test_Tcp_StartError(t *testing.T) {
time.Sleep(time.Millisecond * 10) // to ensure free socket