Package com.google.code.yanf4j.config

Examples of com.google.code.yanf4j.config.Configuration


    map.put(StandardSocketOption.SO_REUSEADDR, true);
    return map;
  }

  public static final Configuration getDefaultConfiguration() {
    final Configuration configuration = new Configuration();
    configuration
        .setSessionReadBufferSize(MemcachedClient.DEFAULT_SESSION_READ_BUFF_SIZE);
    configuration
        .setReadThreadCount(MemcachedClient.DEFAULT_READ_THREAD_COUNT);
    configuration
        .setSessionIdleTimeout(MemcachedClient.DEFAULT_SESSION_IDLE_TIMEOUT);
    configuration.setWriteThreadCount(0);
        return configuration;
  }
View Full Code Here


    protected AbstractController controller;


    @Test
    public void testConfigThreadCount() throws Exception {
        Configuration configuration = new Configuration();
        configuration.setReadThreadCount(10);
        configuration.setWriteThreadCount(1);
        configuration.setDispatchMessageThreadCount(11);
        this.controller = new TCPController(configuration);
        this.controller.setHandler(new HandlerAdapter());
        Assert.assertEquals(10, this.controller.getReadThreadCount());
        Assert.assertEquals(1, this.controller.getWriteThreadCount());
        Assert.assertEquals(11, this.controller.getDispatchMessageThreadCount());
View Full Code Here

    }


    @Test
    public void testSetSocketOption() throws Exception {
        this.controller = new TCPController(new Configuration());
        this.controller.setSocketOption(StandardSocketOption.SO_KEEPALIVE, true);
        Assert.assertEquals(true, this.controller.getSocketOption(StandardSocketOption.SO_KEEPALIVE));

        this.controller.setSocketOption(StandardSocketOption.SO_RCVBUF, 4096);
        Assert.assertEquals((Integer)4096, this.controller.getSocketOption(StandardSocketOption.SO_RCVBUF));
View Full Code Here

    }


    @Test
    public void testNoHandler() throws Exception {
        this.controller = new TCPController(new Configuration());
        Assert.assertNull(this.controller.getHandler());
        try {
            this.controller.start();
            Assert.fail();
        }
View Full Code Here

    }


    @Test
    public void testNoCodecFactory() throws Exception {
        this.controller = new TCPController(new Configuration());
        this.controller.setHandler(new HandlerAdapter());
        Assert.assertNull(this.controller.getCodecFactory());
        this.controller.start();
        Assert.assertTrue(this.controller.getCodecFactory() instanceof ByteBufferCodecFactory);
    }
View Full Code Here

    }


    @Test
    public void testConfig() {
        Configuration configuration = new Configuration();
        this.controller = new TCPController(configuration);
        Assert.assertEquals(configuration.isHandleReadWriteConcurrently(), this.controller.isHandleReadWriteConcurrently());
        this.controller.setHandleReadWriteConcurrently(false);
        Assert.assertFalse(this.controller.isHandleReadWriteConcurrently());

        this.controller.setSessionIdleTimeout(100000);
        Assert.assertEquals(100000, this.controller.getSessionIdleTimeout());
View Full Code Here

  public void setSoTimeout(int timeout) {
    soTimeout = timeout;
  }

  public AbstractController() {
    this(new Configuration(), null, null);
  }
View Full Code Here

    map.put(StandardSocketOption.SO_REUSEADDR, true);
    return map;
  }

  public static final Configuration getDefaultConfiguration() {
    final Configuration configuration = new Configuration();
    configuration
        .setSessionReadBufferSize(MemcachedClient.DEFAULT_SESSION_READ_BUFF_SIZE);
    configuration
        .setReadThreadCount(MemcachedClient.DEFAULT_READ_THREAD_COUNT);
    configuration
        .setSessionIdleTimeout(MemcachedClient.DEFAULT_SESSION_IDLE_TIMEOUT);
    configuration.setWriteThreadCount(0);
    return configuration;
  }
View Full Code Here

public class ConfigurationTest extends TestCase {
  Configuration configuration;

  @Override
  protected void setUp() throws Exception {
    this.configuration = new Configuration();
  }
View Full Code Here

    private SelectorManager selectorManager;


    @Before
    public void setUp() throws Exception {
        Configuration configuration = new Configuration();
        TCPController controller = new TCPController(configuration);
        this.selectorManager = new SelectorManager(1, controller, configuration);
        this.selectorManager.start();
        this.reactor = this.selectorManager.getReactorByIndex(0);
        controller.setSessionTimeout(1000);
View Full Code Here

TOP

Related Classes of com.google.code.yanf4j.config.Configuration

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.