Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 367219

Summary: WebSocketClient.open() fails when URI uses default ports
Product: [RT] Jetty Reporter: Simone Bordet <simone.bordet>
Component: websocketAssignee: Simone Bordet <simone.bordet>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: jetty-inbox
Version: 7.6.0.RC0   
Target Milestone: 7.5.x   
Hardware: PC   
OS: Linux   
Whiteboard:

Description Simone Bordet CLA 2011-12-20 11:49:12 EST
If the WebSocketClient is passed URIs such as ws://localhost with no port information, it fails with:

java.lang.IllegalArgumentException: port out of range:-1
	at java.net.InetSocketAddress.<init>(InetSocketAddress.java:118)
	at org.eclipse.jetty.websocket.WebSocketClient.open(WebSocketClient.java:344)
Comment 1 Simone Bordet CLA 2011-12-20 12:01:29 EST
Fixed by defaulting the ports to 80 and 443 if they are missing from the URI passed to WebSocketClient.open().