/*
 * @(#)WebSocketTransportTest.java 2018. 5. 23.
 *
 * Copyright 2018 NAVER Corp. All rights Reserved. NAVER PROPRIETARY/CONFIDENTIAL. Use is subject to
 * license terms.
 */
package com.corundumstudio.socketio.transport;

import static org.junit.Assert.assertTrue;

import org.junit.Test;

import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.embedded.EmbeddedChannel;
import io.netty.handler.codec.http.websocketx.CloseWebSocketFrame;

/**
 * @author hangsu.cho@navercorp.com
 *
 */
public class WebSocketTransportTest {

  /**
   * Test method for {@link com.corundumstudio.socketio.transport.WebSocketTransport#channelRead()}.
   */
  @Test
  public void testCloseFrame() {
    EmbeddedChannel channel = createChannel();

    channel.writeInbound(new CloseWebSocketFrame());
    Object msg = channel.readOutbound();

    // https://tools.ietf.org/html/rfc6455#section-5.5.1
    // If an endpoint receives a Close frame and did not previously send a Close frame, the endpoint
    // MUST send a Close frame in response.
    assertTrue(msg instanceof CloseWebSocketFrame);
  }

  private EmbeddedChannel createChannel() {
    return new EmbeddedChannel(new WebSocketTransport(false, null, null, null, null) {
      /*
       * (non-Javadoc)
       * 
       * @see
       * com.corundumstudio.socketio.transport.WebSocketTransport#channelInactive(io.netty.channel.
       * ChannelHandlerContext)
       */
      @Override
      public void channelInactive(ChannelHandlerContext ctx) throws Exception {}
    });
  }

}

@@ -52,128 +52,573 @@
 %0D%0A *
+ 
 %0D%0A * 
-Copyright 2018 NAVER Corp. All rights Reserved. NAVER PROPRIETARY/CONFIDENTIAL. Use is subject to%0D%0A * license terms
+Licensed under the Apache License, Version 2.0 (the %22License%22);%0D%0A * you may not use this file except in compliance with the License.%0D%0A * You may obtain a copy of the License at%0D%0A *%0D%0A *    http://www.apache.org/licenses/LICENSE-2.0%0D%0A *%0D%0A * Unless required by applicable law or agreed to in writing, software%0D%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0D%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0D%0A * See the License for the specific language governing permissions and%0D%0A * limitations under the License
 .%0D%0A 

add apache license comment