class B2Session extends HttpSession<B2ApiClient> {

    @Override
    public void login(final Proxy proxy, final LoginCallback prompt, final CancelCallback cancel) throws BackgroundException {
        try {
            final String accountId = host.getCredentials().getUsername();
            final String applicationKey = host.getCredentials().getPassword();
            // Save tokens for 401 error response when expired
            final B2AuthorizeAccountResponse response = client.authenticate(accountId, applicationKey);
            // When present, access is restricted to one bucket
            if(StringUtils.isNotBlank(response.getBucketId())) {
                final PathAttributes attributes = new PathAttributes();
                attributes.setVersionId(response.getBucketId());
                listService.withBucket(new Path(PathNormalizer.normalize(response.getBucketName()), EnumSet.of(Path.Type.directory, Path.Type.volume), attributes));
            }
            retryHandler.setTokens(accountId, applicationKey, response.getAuthorizationToken());
        }
        catch(B2ApiException e) {
            throw new B2ExceptionMappingService().map(e);
        }
        catch(IOException e) {
            throw new DefaultIOExceptionMappingService().map(e);
        }
    }

    public  B2Session(final Host host, final X509TrustManager trust, final X509KeyManager key);

}