001/** 002 * Logback: the reliable, generic, fast and flexible logging framework. 003 * Copyright (C) 1999-2015, QOS.ch. All rights reserved. 004 * 005 * This program and the accompanying materials are dual-licensed under 006 * either the terms of the Eclipse Public License v1.0 as published by 007 * the Eclipse Foundation 008 * 009 * or (per the licensee's choosing) 010 * 011 * under the terms of the GNU Lesser General Public License version 2.1 012 * as published by the Free Software Foundation. 013 */ 014package ch.qos.logback.classic.net; 015 016import static org.junit.Assert.assertNotNull; 017 018import java.net.InetAddress; 019 020import org.junit.Before; 021import org.junit.Test; 022import org.slf4j.LoggerFactory; 023 024import ch.qos.logback.classic.LoggerContext; 025 026/** 027 * Unit tests for {@link SSLSocketReceiver}. 028 * 029 * @author Carl Harris 030 */ 031public class SSLSocketReceiverTest { 032 033 private SSLSocketReceiver remote = new SSLSocketReceiver(); 034 035 @Before 036 public void setUp() throws Exception { 037 LoggerContext lc = (LoggerContext) LoggerFactory.getILoggerFactory(); 038 remote.setContext(lc); 039 } 040 041 @Test 042 public void testUsingDefaultConfig() throws Exception { 043 // should be able to start successfully with no SSL configuration at all 044 remote.setRemoteHost(InetAddress.getLocalHost().getHostAddress()); 045 remote.setPort(6000); 046 remote.start(); 047 assertNotNull(remote.getSocketFactory()); 048 } 049 050}