@@ -155,7 +155,7 @@ public void decode( ByteBuffer socketBuffer ) {
155155 System .out .println ( "process(" + socketBuffer .remaining () + "): {" + ( socketBuffer .remaining () > 1000 ? "too big to display" : new String ( socketBuffer .array (), socketBuffer .position (), socketBuffer .remaining () ) ) + "}" );
156156
157157 if ( readystate != READYSTATE .NOT_YET_CONNECTED ) {
158- decodeFrames ( socketBuffer );;
158+ decodeFrames ( socketBuffer );
159159 } else {
160160 if ( decodeHandshake ( socketBuffer ) ) {
161161 assert ( tmpHandshakeBytes .hasRemaining () != socketBuffer .hasRemaining () || !socketBuffer .hasRemaining () ); // the buffers will never have remaining bytes at the same time
@@ -203,7 +203,7 @@ private boolean decodeHandshake( ByteBuffer socketBufferNew ) {
203203 return false ;
204204 }
205205 }
206- HandshakeState handshakestate = null ;
206+ HandshakeState handshakestate ;
207207
208208 try {
209209 if ( role == Role .SERVER ) {
@@ -214,7 +214,7 @@ private boolean decodeHandshake( ByteBuffer socketBufferNew ) {
214214 d .setParseMode ( role );
215215 socketBuffer .reset ();
216216 Handshakedata tmphandshake = d .translateHandshake ( socketBuffer );
217- if ( tmphandshake instanceof ClientHandshake == false ) {
217+ if (!( tmphandshake instanceof ClientHandshake ) ) {
218218 flushAndClose ( CloseFrame .PROTOCOL_ERROR , "wrong http function" , false );
219219 return false ;
220220 }
@@ -249,7 +249,7 @@ private boolean decodeHandshake( ByteBuffer socketBufferNew ) {
249249 } else {
250250 // special case for multiple step handshakes
251251 Handshakedata tmphandshake = draft .translateHandshake ( socketBuffer );
252- if ( tmphandshake instanceof ClientHandshake == false ) {
252+ if (!( tmphandshake instanceof ClientHandshake ) ) {
253253 flushAndClose ( CloseFrame .PROTOCOL_ERROR , "wrong http function" , false );
254254 return false ;
255255 }
@@ -267,7 +267,7 @@ private boolean decodeHandshake( ByteBuffer socketBufferNew ) {
267267 } else if ( role == Role .CLIENT ) {
268268 draft .setParseMode ( role );
269269 Handshakedata tmphandshake = draft .translateHandshake ( socketBuffer );
270- if ( tmphandshake instanceof ServerHandshake == false ) {
270+ if (!( tmphandshake instanceof ServerHandshake ) ) {
271271 flushAndClose ( CloseFrame .PROTOCOL_ERROR , "wrong http function" , false );
272272 return false ;
273273 }
@@ -397,7 +397,7 @@ private void close( int code, String message, boolean remote ) {
397397 if ( readystate != READYSTATE .CLOSING && readystate != READYSTATE .CLOSED ) {
398398 if ( readystate == READYSTATE .OPEN ) {
399399 if ( code == CloseFrame .ABNORMAL_CLOSE ) {
400- assert ( remote == false );
400+ assert (! remote );
401401 readystate = READYSTATE .CLOSING ;
402402 flushAndClose ( code , message , false );
403403 return ;
@@ -539,9 +539,7 @@ public void close( InvalidDataException e ) {
539539
540540 /**
541541 * Send Text data to the other end.
542- *
543- * @throws IllegalArgumentException
544- * @throws NotYetConnectedException
542+ * @throws NotYetConnectedException websocket is not yet connected
545543 */
546544 @ Override
547545 public void send ( String text ) throws WebsocketNotConnectedException {
@@ -552,9 +550,9 @@ public void send( String text ) throws WebsocketNotConnectedException {
552550
553551 /**
554552 * Send Binary data (plain bytes) to the other end.
555- *
556- * @throws IllegalArgumentException
557- * @throws NotYetConnectedException
553+ *
554+ * @throws IllegalArgumentException the data is null
555+ * @throws NotYetConnectedException websocket is not yet connected
558556 */
559557 @ Override
560558 public void send ( ByteBuffer bytes ) throws IllegalArgumentException , WebsocketNotConnectedException {
@@ -669,13 +667,13 @@ private void open( Handshakedata d ) {
669667
670668 @ Override
671669 public boolean isConnecting () {
672- assert ( flushandclosestate ? readystate == READYSTATE .CONNECTING : true );
670+ assert (! flushandclosestate || readystate == READYSTATE .CONNECTING );
673671 return readystate == READYSTATE .CONNECTING ; // ifflushandclosestate
674672 }
675673
676674 @ Override
677675 public boolean isOpen () {
678- assert ( readystate == READYSTATE .OPEN ? !flushandclosestate : true );
676+ assert (readystate != READYSTATE .OPEN || !flushandclosestate );
679677 return readystate == READYSTATE .OPEN ;
680678 }
681679
0 commit comments