Skip to content

Consider adding a function to expose the actual port being listened on #1065

Description

@HouzuoGuo

Issue Description

Test cases often run HTTP server without specifying a port number, in order for the server to listen on any available port. Afterwards, the test case author peeks into the listener structure to find out the actual port number, using code similar to:

echoSrv.Listener.(*net.TCPListener).Addr().(*net.TCPAddr).Port

However, the method will not work with echo because the listener is a private extension of TCPListener, therefore it is impossible to find out actual port number being listened on. Consequently, it becomes difficult to run parallel tests against an echo HTTP server.

Therefore, please consider exporting the private TCPListener extension, or make a function dedicated to finding out the listener's port number.

Version/commit

master at e9f6780

Metadata

Metadata

Assignees

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions