### Question:
AbstractSocketAppender extends AppenderBase<E> implements SocketConnector.ExceptionHandler { public void start() { if (isStarted()) return; int errorCount = 0; if (port <= 0) { errorCount++; addError("No port was configured for appender" + name + " For more information, please visit http: } if (remoteHost == null) { errorCount++; addError("No remote host was configured for appender" + name + " For more information, please visit http: } if (queueSize == 0) { addWarn("Queue size of zero is deprecated, use a size of one to indicate synchronous processing"); } if (queueSize < 0) { errorCount++; addError("Queue size must be greater than zero"); } if (errorCount == 0) { try { address = InetAddress.getByName(remoteHost); } catch (UnknownHostException ex) { addError("unknown host: " + remoteHost); errorCount++; } } if (errorCount == 0) { deque = queueFactory.newLinkedBlockingDeque(queueSize); peerId = "remote peer " + remoteHost + ":" + port + ": "; connector = createConnector(address, port, 0, reconnectionDelay.getMilliseconds()); task = getContext().getScheduledExecutorService().submit(new Runnable() { public void run() { connectSocketAndDispatchEvents(); } }); super.start(); } } protected  AbstractSocketAppender();   AbstractSocketAppender(QueueFactory queueFactory, ObjectWriterFactory objectWriterFactory); void start(); @Override void stop(); void connectionFailed(SocketConnector connector, Exception ex); void setRemoteHost(String host); String getRemoteHost(); void setPort(int port); int getPort(); void setReconnectionDelay(Duration delay); Duration getReconnectionDelay(); void setQueueSize(int queueSize); int getQueueSize(); void setEventDelayLimit(Duration eventDelayLimit); Duration getEventDelayLimit(); static final int DEFAULT_PORT; static final int DEFAULT_RECONNECTION_DELAY; static final int DEFAULT_QUEUE_SIZE; }### Answer:
@Test public void startsWithValidParameters() throws Exception { appender.start(); assertTrue(appender.isStarted()); }
@Test public void addsInfoMessageWhenSocketConnectionWasEstablished() throws Exception { mockOneSuccessfulSocketConnection(); appender.start(); verify(appender, timeout(TIMEOUT)).addInfo(contains("connection established")); }
@Test public void shutsDownOnInterruptWhileWaitingForEvent() throws Exception { mockOneSuccessfulSocketConnection(); doThrow(new InterruptedException()).when(deque).takeFirst(); appender.start(); verify(deque, timeout(TIMEOUT)).takeFirst(); }
@Test public void shutsDownOnInterruptWhileWaitingForSocketConnection() throws Exception { doThrow(new InterruptedException()).when(socketConnector).call(); appender.start(); verify(socketConnector, timeout(TIMEOUT)).call(); }
@Test public void addsInfoMessageWhenShuttingDownDueToInterrupt() throws Exception { doThrow(new InterruptedException()).when(socketConnector).call(); appender.start(); verify(appender, timeout(TIMEOUT)).addInfo(contains("shutting down")); }