Skip to content

Commit 8780c85

Browse files
committed
Merge pull request TooTallNate#83 from Davidiusdadi/master
Since the current head of this project is not working properly for more than a week now because i made a stupid mistake during merging stuff that should have belonged to this pull request i will now merge this pull request to be able focus on one branch instead of too. @sippykup Thanks for revealing those problems!
2 parents 1553b14 + 071f051 commit 8780c85

30 files changed

Lines changed: 920 additions & 773 deletions

‎example/AutobahnClientTest.java‎

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -127,12 +127,7 @@ public static void main( String[] args ) {
127127

128128
@Override
129129
public void onMessage( String message ) {
130-
try {
131-
send( message );
132-
} catch ( InterruptedException e ) {
133-
e.printStackTrace();
134-
}
135-
130+
send( message );
136131
}
137132

138133
@Override

‎example/AutobahnServerTest.java‎

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import java.net.InetSocketAddress;
22
import java.net.UnknownHostException;
33
import java.nio.ByteBuffer;
4+
import java.util.Collections;
45

56
import org.java_websocket.WebSocket;
67
import org.java_websocket.WebSocketServer;
@@ -11,12 +12,12 @@
1112
public class AutobahnServerTest extends WebSocketServer {
1213
private static int counter = 0;
1314

14-
public AutobahnServerTest( int port, Draft d ) throws UnknownHostException {
15-
super( new InetSocketAddress( "localhost", port ), d );
15+
public AutobahnServerTest( int port , Draft d ) throws UnknownHostException {
16+
super( new InetSocketAddress( port ), Collections.singletonList( d ) );
1617
}
1718

1819
public AutobahnServerTest( InetSocketAddress address, Draft d ) {
19-
super( address, d );
20+
super( address, Collections.singletonList( d ) );
2021
}
2122

2223
@Override
@@ -37,11 +38,7 @@ public void onError( WebSocket conn, Exception ex ) {
3738

3839
@Override
3940
public void onMessage( WebSocket conn, String message ) {
40-
try {
41-
conn.send( message );
42-
} catch ( InterruptedException e ) {
43-
e.printStackTrace();
44-
}
41+
conn.send( message );
4542
}
4643

4744
@Override

‎example/ChatClient.java‎

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -90,13 +90,9 @@ public void actionPerformed( ActionEvent e ) {
9090

9191
if( e.getSource() == chatField ) {
9292
if( cc != null ) {
93-
try {
94-
cc.send( chatField.getText() );
95-
chatField.setText( "" );
96-
chatField.requestFocus();
97-
} catch ( InterruptedException ex ) {
98-
ex.printStackTrace();
99-
}
93+
cc.send( chatField.getText() );
94+
chatField.setText( "" );
95+
chatField.requestFocus();
10096
}
10197

10298
} else if( e.getSource() == connect ) {

‎example/ChatServer.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public ChatServer( InetSocketAddress address ) {
2626
@Override
2727
public void onOpen( WebSocket conn, ClientHandshake handshake ) {
2828
try {
29-
this.sendToAll( "new" );
29+
this.sendToAll( "new connection" );
3030
} catch ( InterruptedException ex ) {
3131
ex.printStackTrace();
3232
}

‎example/EmptyClient.java‎

Lines changed: 0 additions & 33 deletions
This file was deleted.

‎example/ServerStressTest.java‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ public void adjust() throws InterruptedException {
155155
}
156156
int totalclients = clients.getValue();
157157
while ( websockets.size() < totalclients ) {
158-
WebSocketClient cl = new EmptyClient( uri ) {
158+
WebSocketClient cl = new ExampleClient( uri ) {
159159
@Override
160160
public void onClose( int code, String reason, boolean remote ) {
161161
System.out.println( "Closed duo " + code + " " + reason );
@@ -203,8 +203,6 @@ public void send() {
203203
cl.flush();
204204
} catch ( NotYetConnectedException e ) {
205205
notyetconnected++;
206-
} catch ( InterruptedException e ) {
207-
e.printStackTrace();
208206
}
209207
}
210208
}

0 commit comments

Comments
 (0)