package org.netmelody.cii;

import java.net.InetSocketAddress;
import java.net.SocketAddress;

import org.netmelody.cii.persistence.State;
import org.netmelody.cii.response.CiEyeResourceEngine;
import org.simpleframework.http.core.Container;
import org.simpleframework.http.resource.ResourceContainer;
import org.simpleframework.transport.connect.Connection;
import org.simpleframework.transport.connect.SocketConnection;

public final class CiEye {
    
    public static void main(String[] list) throws Exception {
        final State state = new State();
        final Container container = new ResourceContainer(new CiEyeResourceEngine(state));
        final Connection connection = new SocketConnection(container);
        final SocketAddress address = new InetSocketAddress(8888);
        
        connection.connect(address);
    }
}

@@ -21,16 +21,44 @@
 y.cii;%0A%0A
+import java.io.IOException;%0A
 import j
@@ -485,72 +485,14 @@
    p
-ublic static void main(String%5B%5D list) throws Exception %7B%0A       
+rivate
  fin
@@ -521,27 +521,31 @@
 tate();%0A    
-   
+private
  final Conta
@@ -616,27 +616,31 @@
 tate));%0A    
-   
+private
  final Conne
@@ -655,16 +655,232 @@
 nnection
+;%0A    private final SocketAddress address;%0A%0A    public static void main(String%5B%5D list) throws Exception %7B%0A        new CiEye(8888).start();%0A    %7D%0A    %0A    public CiEye(int port) throws IOException %7B%0A        connection
  = new S
@@ -914,36 +914,16 @@
 %0A       
- final SocketAddress
  address
@@ -951,23 +951,67 @@
 ess(
-8888
+port
 );%0A    
+%7D%0A%0A
     
+private void start() throws IOException %7B
 %0A   

refactor main method