ServerConnection implements PayloadHandling { public void abort() { connectionsClient.stopAllEndpoints(); resetDiscovery(); resetClientData(); } private  ServerConnection(); static ServerConnection getInstance(); void init(Context ctx); @Override void addHandle(int type, HandlePayload handle); @Override HandlePayload getHandle(int type); @Override void handlePayload(Payload payload); @Override void handlePayloadUpdate(PayloadTransferUpdate update); void discover(ConnectCallback callback, EndpointDiscoveryCallback discoveryCallback); List<String> getClients(); String getClientID(); void discoverConnect(String code, ConnectCallback callback); void connectTo(String code, ConnectCallback callback); void abort(); PipedOutputStream sendStream(); EndpointDiscoveryCallback buildEndpointDiscoveryCallback(String name, ConnectCallback callback); boolean isConnected();  }
@Test public void abort() { ServerConnection connection = ServerConnection.getInstance(); Whitebox.setInternalState(connection, "connectionsClient", mockClient); connection.abort(); assertNull(connection.getClientID()); List<String> empty = Collections.emptyList(); assertEquals(empty, connection.getClients()); }