001/*
002 * acme4j - Java ACME client
003 *
004 * Copyright (C) 2015 Richard "Shred" Körber
005 *   http://acme4j.shredzone.org
006 *
007 * Licensed under the Apache License, Version 2.0 (the "License");
008 * you may not use this file except in compliance with the License.
009 *
010 * This program is distributed in the hope that it will be useful,
011 * but WITHOUT ANY WARRANTY; without even the implied warranty of
012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
013 */
014package org.shredzone.acme4j.connector;
015
016import java.net.URL;
017import java.security.KeyPair;
018import java.security.cert.X509Certificate;
019import java.time.Instant;
020import java.time.ZonedDateTime;
021import java.util.Collection;
022import java.util.List;
023import java.util.Optional;
024
025import org.shredzone.acme4j.Login;
026import org.shredzone.acme4j.Session;
027import org.shredzone.acme4j.exception.AcmeException;
028import org.shredzone.acme4j.toolbox.JSON;
029import org.shredzone.acme4j.toolbox.JSONBuilder;
030
031/**
032 * Dummy implementation of {@link Connection} that always fails. Single methods are
033 * supposed to be overridden for testing.
034 */
035public class DummyConnection implements Connection {
036
037    @Override
038    public void resetNonce(Session session) {
039        throw new UnsupportedOperationException();
040    }
041
042    @Override
043    public int sendRequest(URL url, Session session, ZonedDateTime ifModifiedSince) {
044        throw new UnsupportedOperationException();
045    }
046
047    @Override
048    public int sendCertificateRequest(URL url, Login login) {
049        throw new UnsupportedOperationException();
050    }
051
052    @Override
053    public int sendSignedPostAsGetRequest(URL url, Login login) {
054        throw new UnsupportedOperationException();
055    }
056
057    @Override
058    public int sendSignedRequest(URL url, JSONBuilder claims, Login login)
059                throws AcmeException {
060        throw new UnsupportedOperationException();
061    }
062
063    @Override
064    public int sendSignedRequest(URL url, JSONBuilder claims, Session session, KeyPair keypair) {
065        throw new UnsupportedOperationException();
066    }
067
068    @Override
069    public JSON readJsonResponse() {
070        throw new UnsupportedOperationException();
071    }
072
073    @Override
074    public List<X509Certificate> readCertificates() {
075        throw new UnsupportedOperationException();
076    }
077
078    @Override
079    public Optional<Instant> getRetryAfter() {
080        throw new UnsupportedOperationException();
081    }
082
083    @Override
084    public Optional<String> getNonce() {
085        throw new UnsupportedOperationException();
086    }
087
088    @Override
089    public URL getLocation() {
090        throw new UnsupportedOperationException();
091    }
092
093    @Override
094    public Optional<ZonedDateTime> getLastModified() {
095        throw new UnsupportedOperationException();
096    }
097
098    @Override
099    public Optional<ZonedDateTime> getExpiration() {
100        throw new UnsupportedOperationException();
101    }
102
103    @Override
104    public Collection<URL> getLinks(String relation) {
105        throw new UnsupportedOperationException();
106    }
107
108    @Override
109    public void close() {
110        // closing is always safe
111    }
112
113}