github.com/annchain/OG@v0.0.9/rpc/server_test.go (about)

     1  package rpc
     2  
     3  import (
     4  	"fmt"
     5  	"github.com/sirupsen/logrus"
     6  	"io"
     7  	"os"
     8  	"testing"
     9  	"time"
    10  )
    11  
    12  func TestNewRpcServer(t *testing.T) {
    13  	logrus.SetLevel(logrus.TraceLevel)
    14  	logFile, err := os.OpenFile("hihi.log", os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0644)
    15  	if err != nil {
    16  		panic(err)
    17  	}
    18  	fmt.Println("Will be logged to stdout and ", logFile)
    19  	writer := io.MultiWriter(logFile)
    20  	logrus.SetOutput(writer)
    21  	rpc := NewRpcServer("9090")
    22  	rpc.Start()
    23  	time.Sleep(time.Second * 20)
    24  }