Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
go
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
go
Commits
ce65b725
Commit
ce65b725
authored
Mar 06, 2011
by
Robert Hencke
Committed by
Russ Cox
Mar 06, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
websocket: use httptest.Server for tests
R=rsc CC=golang-dev
https://golang.org/cl/4266044
parent
59d2acd2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
7 deletions
+4
-7
src/pkg/websocket/websocket_test.go
src/pkg/websocket/websocket_test.go
+4
-7
No files found.
src/pkg/websocket/websocket_test.go
View file @
ce65b725
...
@@ -9,6 +9,7 @@ import (
...
@@ -9,6 +9,7 @@ import (
"bytes"
"bytes"
"fmt"
"fmt"
"http"
"http"
"http/httptest"
"io"
"io"
"log"
"log"
"net"
"net"
...
@@ -22,15 +23,11 @@ var once sync.Once
...
@@ -22,15 +23,11 @@ var once sync.Once
func
echoServer
(
ws
*
Conn
)
{
io
.
Copy
(
ws
,
ws
)
}
func
echoServer
(
ws
*
Conn
)
{
io
.
Copy
(
ws
,
ws
)
}
func
startServer
()
{
func
startServer
()
{
l
,
e
:=
net
.
Listen
(
"tcp"
,
"127.0.0.1:0"
)
// any available address
if
e
!=
nil
{
log
.
Fatalf
(
"net.Listen tcp :0 %v"
,
e
)
}
serverAddr
=
l
.
Addr
()
.
String
()
log
.
Print
(
"Test WebSocket server listening on "
,
serverAddr
)
http
.
Handle
(
"/echo"
,
Handler
(
echoServer
))
http
.
Handle
(
"/echo"
,
Handler
(
echoServer
))
http
.
Handle
(
"/echoDraft75"
,
Draft75Handler
(
echoServer
))
http
.
Handle
(
"/echoDraft75"
,
Draft75Handler
(
echoServer
))
go
http
.
Serve
(
l
,
nil
)
server
:=
httptest
.
NewServer
(
nil
)
serverAddr
=
server
.
Listener
.
Addr
()
.
String
()
log
.
Print
(
"Test WebSocket server listening on "
,
serverAddr
)
}
}
// Test the getChallengeResponse function with values from section
// Test the getChallengeResponse function with values from section
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment