// Path: wasync/src/main/java/org/atmosphere/wasync/impl/DefaultClient.java
// public class DefaultClient implements Client<DefaultOptions, OptionsBuilder,RequestBuilder> {
// 
//     public DefaultClient() {
//     }
// 
//     /**
//      * {@inheritDoc}
//      */
//     @Override
//     public Socket create() {
//         return ClientUtil.create();
//     }
// 
//     /**
//      * {@inheritDoc}
//      */
//     @Override
//     public Socket create(DefaultOptions options) {
//         return ClientUtil.create(options);
//     }
// 
//     /**
//      * {@inheritDoc}
//      */
//     @Override
//     public RequestBuilder newRequestBuilder() {
//         RequestBuilder b = new DefaultRequestBuilder();
//         return b.resolver(FunctionResolver.DEFAULT);
//     }
// 
//     /**
//      * {@inheritDoc}
//      */
//     @Override
//     public OptionsBuilder newOptionsBuilder() {
//         return new DefaultOptionsBuilder();
//     }
// 
//     /**
//      * {@inheritDoc}
//      */
//     @Override
//     public RequestBuilder newRequestBuilder(Class<RequestBuilder> clazz) {
//         RequestBuilder b = null;
//         try {
//             b = clazz.newInstance();
//         } catch (InstantiationException e) {
//             throw new RuntimeException(e);
//         } catch (IllegalAccessException e) {
//             throw new RuntimeException(e);
//         }
//         return b.resolver(FunctionResolver.DEFAULT);
//     }
// }


import org.atmosphere.wasync.impl.DefaultClient;
/*
 * Copyright 2008-2022 Async-IO.org
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 */
package org.atmosphere.wasync;


/**
 * Create a {@link Client}. By default, the {@link DefaultClient} will be returned. To override the {@link DefaultClient},
 * just specify the provider using the -Dwasync.client property.
 *
 * @author Jeanfrancois Arcand
 */
public class ClientFactory {

    private final static ClientFactory factory = new ClientFactory();
    private final String clientClassName;

    public ClientFactory() {
        clientClassName = System.getProperty("wasync.client");
    }

    /**
     * Return the default Factory.
     *
     * @return this
     */
    public final static ClientFactory getDefault() {
        return factory;
    }

    /**
     * Return a new {@link Client} instance
     *
     * @return a new {@link Client} instance
     */
    public Client<? extends Options, ? extends OptionsBuilder, ? extends RequestBuilder> newClient() {
        if (clientClassName == null) {
// Path: wasync/src/main/java/org/atmosphere/wasync/impl/DefaultClient.java
// public class DefaultClient implements Client<DefaultOptions, OptionsBuilder,RequestBuilder> {
// 
//     public DefaultClient() {
//     }
// 
//     /**
//      * {@inheritDoc}
//      */
//     @Override
//     public Socket create() {
//         return ClientUtil.create();
//     }
// 
//     /**
//      * {@inheritDoc}
//      */
//     @Override
//     public Socket create(DefaultOptions options) {
//         return ClientUtil.create(options);
//     }
// 
//     /**
//      * {@inheritDoc}
//      */
//     @Override
//     public RequestBuilder newRequestBuilder() {
//         RequestBuilder b = new DefaultRequestBuilder();
//         return b.resolver(FunctionResolver.DEFAULT);
//     }
// 
//     /**
//      * {@inheritDoc}
//      */
//     @Override
//     public OptionsBuilder newOptionsBuilder() {
//         return new DefaultOptionsBuilder();
//     }
// 
//     /**
//      * {@inheritDoc}
//      */
//     @Override
//     public RequestBuilder newRequestBuilder(Class<RequestBuilder> clazz) {
//         RequestBuilder b = null;
//         try {
//             b = clazz.newInstance();
//         } catch (InstantiationException e) {
//             throw new RuntimeException(e);
//         } catch (IllegalAccessException e) {
//             throw new RuntimeException(e);
//         }
//         return b.resolver(FunctionResolver.DEFAULT);
//     }
// }


// Path: wasync/src/main/java/org/atmosphere/wasync/ClientFactory.java
import org.atmosphere.wasync.impl.DefaultClient;

/*
 * Copyright 2008-2022 Async-IO.org
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 */
package org.atmosphere.wasync;


/**
 * Create a {@link Client}. By default, the {@link DefaultClient} will be returned. To override the {@link DefaultClient},
 * just specify the provider using the -Dwasync.client property.
 *
 * @author Jeanfrancois Arcand
 */
public class ClientFactory {

    private final static ClientFactory factory = new ClientFactory();
    private final String clientClassName;

    public ClientFactory() {
        clientClassName = System.getProperty("wasync.client");
    }

    /**
     * Return the default Factory.
     *
     * @return this
     */
    public final static ClientFactory getDefault() {
        return factory;
    }

    /**
     * Return a new {@link Client} instance
     *
     * @return a new {@link Client} instance
     */
    public Client<? extends Options, ? extends OptionsBuilder, ? extends RequestBuilder> newClient() {
        if (clientClassName == null) {
            return new DefaultClient();