本文整理汇总了Java中org.productivity.java.syslog4j.server.impl.net.udp.UDPNetSyslogServerConfig类的典型用法代码示例。如果您正苦于以下问题:Java UDPNetSyslogServerConfig类的具体用法?Java UDPNetSyslogServerConfig怎么用?Java UDPNetSyslogServerConfig使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
UDPNetSyslogServerConfig类属于org.productivity.java.syslog4j.server.impl.net.udp包,在下文中一共展示了UDPNetSyslogServerConfig类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setUp
import org.productivity.java.syslog4j.server.impl.net.udp.UDPNetSyslogServerConfig; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
serverStream = new ByteArrayOutputStream();
PrintStream ps = new PrintStream(serverStream);
final TCPNetSyslogServerConfig tcpNetSyslogServerConfig = new TCPNetSyslogServerConfig(45553);
tcpNetSyslogServerConfig.addEventHandler(new PrintStreamSyslogServerEventHandler(ps));
final UDPNetSyslogServerConfig udpNetSyslogServerConfig = new UDPNetSyslogServerConfig(45553);
udpNetSyslogServerConfig.addEventHandler(new PrintStreamSyslogServerEventHandler(ps));
final SSLTCPNetSyslogServerConfig ssltcpNetSyslogServerConfig = new SSLTCPNetSyslogServerConfig();
ssltcpNetSyslogServerConfig.setPort(45554);
ssltcpNetSyslogServerConfig.addEventHandler(new PrintStreamSyslogServerEventHandler(ps));
final String keyStore = this.getClass().getClassLoader().getResource("test-keystore.jks").getFile();
ssltcpNetSyslogServerConfig.setKeyStore(keyStore);
ssltcpNetSyslogServerConfig.setKeyStorePassword("password");
ssltcpNetSyslogServerConfig.setTrustStore(keyStore);
ssltcpNetSyslogServerConfig.setTrustStorePassword("password");
SyslogServer.createThreadedInstance("testTcp", tcpNetSyslogServerConfig);
SyslogServer.createThreadedInstance("testUdp", udpNetSyslogServerConfig);
SyslogServer.createThreadedInstance("testTls", ssltcpNetSyslogServerConfig);
}
示例2: setUp
import org.productivity.java.syslog4j.server.impl.net.udp.UDPNetSyslogServerConfig; //导入依赖的package包/类
protected void setUp() {
serverStream = new ByteArrayOutputStream();
PrintStream ps = new PrintStream(serverStream);
final TCPNetSyslogServerConfig tcpNetSyslogServerConfig = new TCPNetSyslogServerConfig(45553);
tcpNetSyslogServerConfig.addEventHandler(new PrintStreamSyslogServerEventHandler(ps));
final UDPNetSyslogServerConfig udpNetSyslogServerConfig = new UDPNetSyslogServerConfig(45553);
udpNetSyslogServerConfig.addEventHandler(new PrintStreamSyslogServerEventHandler(ps));
final SSLTCPNetSyslogServerConfig ssltcpNetSyslogServerConfig = new SSLTCPNetSyslogServerConfig();
ssltcpNetSyslogServerConfig.setPort(45554);
ssltcpNetSyslogServerConfig.addEventHandler(new PrintStreamSyslogServerEventHandler(ps));
ssltcpNetSyslogServerConfig.setKeyStore(this.getClass().getClassLoader().getResource("test-keystore.jks").getFile());
ssltcpNetSyslogServerConfig.setKeyStorePassword("password");
ssltcpNetSyslogServerConfig.setTrustStore(this.getClass().getClassLoader().getResource("test-keystore.jks").getFile());
ssltcpNetSyslogServerConfig.setTrustStorePassword("password");
SyslogServer.createThreadedInstance("testTcp", tcpNetSyslogServerConfig);
SyslogServer.createThreadedInstance("testUdp", udpNetSyslogServerConfig);
SyslogServer.createThreadedInstance("testTls", ssltcpNetSyslogServerConfig);
}
示例3: startServer
import org.productivity.java.syslog4j.server.impl.net.udp.UDPNetSyslogServerConfig; //导入依赖的package包/类
/**
* Getting ready for tests.
* @throws InterruptedException
*/
@Before
public void startServer() throws InterruptedException {
MockLogAppender.setupLogging();
SyslogServerConfigIF serverConfig = new UDPNetSyslogServerConfig(SERVER_HOST, SERVER_PORT);
serverConfig.setShutdownWait(0);
m_logStream = new TestPrintStream(new StringOutputStream());
SyslogServerEventHandlerIF eventHandler = new PrintStreamSyslogServerEventHandler(m_logStream);
serverConfig.addEventHandler(eventHandler);
m_server = SyslogServer.createThreadedInstance("test-udp", serverConfig);
m_server.initialize("udp", serverConfig);
//Need this sleep, found a deadlock in the server.
Thread.sleep(100);
m_server.run();
}
示例4: testCreateAndDestroyServerByProtocol
import org.productivity.java.syslog4j.server.impl.net.udp.UDPNetSyslogServerConfig; //导入依赖的package包/类
public void testCreateAndDestroyServerByProtocol() {
UDPNetSyslogServerConfig config = new UDPNetSyslogServerConfig();
config.setPort(999);
SyslogServerIF server = SyslogServer.createInstance("udpToDestroy",config);
SyslogServerIF matchServer = SyslogServer.getInstance("udpToDestroy");
assertEquals(server,matchServer);
SyslogServer.destroyInstance("");
SyslogServer.destroyInstance("udpToDestroy");
try {
SyslogServer.getInstance("udpToDestroy");
fail("udpToDestroy should not exist");
} catch (SyslogRuntimeException sre) {
//
}
assertFalse(SyslogServer.getSuppressRuntimeExceptions());
SyslogServer.setSuppressRuntimeExceptions(true);
assertTrue(SyslogServer.getSuppressRuntimeExceptions());
assertNull(SyslogServer.getInstance("udpToDestroy"));
SyslogServer.setSuppressRuntimeExceptions(false);
}
示例5: initialize
import org.productivity.java.syslog4j.server.impl.net.udp.UDPNetSyslogServerConfig; //导入依赖的package包/类
public synchronized static void initialize() {
createInstance(UDP,new UDPNetSyslogServerConfig());
createInstance(TCP,new TCPNetSyslogServerConfig());
}
示例6: testUDPSession
import org.productivity.java.syslog4j.server.impl.net.udp.UDPNetSyslogServerConfig; //导入依赖的package包/类
public void testUDPSession() {
SyslogServerConfigIF serverConfig = new UDPNetSyslogServerConfig(9999);
UDPSessionHandler handler1 = new UDPSessionHandler("a");
serverConfig.addEventHandler(handler1);
UDPSessionHandler handler2 = new UDPSessionHandler("b");
serverConfig.addEventHandler(handler2);
SyslogServer.createThreadedInstance("udp_session",serverConfig);
SyslogUtility.sleep(100);
assertTrue(handler1.initialized);
assertTrue(handler2.initialized);
SyslogConfigIF config = new UDPNetSyslogConfig();
config.setPort(9999);
SyslogIF syslog1 = Syslog.createInstance("udp_session_1",config);
syslog1.info("1");
syslog1.info("2");
SyslogIF syslog2 = Syslog.createInstance("udp_session_2",config);
syslog2.info("3");
syslog2.info("4");
SyslogUtility.sleep(100);
syslog1.shutdown();
syslog2.shutdown();
SyslogServer.destroyInstance("udp_session");
try {
SyslogServer.getInstance("udp_session");
fail();
} catch (SyslogRuntimeException sre) {
//
}
assertTrue(handler1.okay);
assertTrue(handler2.okay);
SyslogUtility.sleep(250);
assertTrue(handler1.destroyed);
assertTrue(handler2.destroyed);
}