Added the start of RPC + removed proxy functions.

* Set the listener of the server when opened.

* refactor server RPC.

* deleted proxy functions + moved TCPPeer to tcp file

* implemented the start of JSON-RPC

* changed string port args to int

* added peerCount.

* Start a server with startOpts

* Updated README
This commit is contained in:
Anthony De Meulemeester 2018-02-01 09:00:42 +01:00 committed by GitHub
parent 0eeb15f62d
commit 83306a5c96
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 341 additions and 220 deletions

View file

@ -24,6 +24,20 @@ func TestHandleVersion(t *testing.T) {
}
}
func TestPeerCount(t *testing.T) {
s := NewServer(ModeDevNet)
go s.loop()
lenPeers := 10
for i := 0; i < lenPeers; i++ {
s.register <- NewLocalPeer(s)
}
if have, want := s.peerCount(), lenPeers; want != have {
t.Fatalf("expected %d connected peers got %d", want, have)
}
}
func TestHandleAddrCmd(t *testing.T) {
// todo
}