• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

nats-io / nats.java / #2091

01 Aug 2025 02:39PM UTC coverage: 95.515% (-0.09%) from 95.606%
#2091

push

github

web-flow
Merge pull request #1378 from nats-io/nats-inet-address

Create NatsInetAddress to allow replacement of InetAddress

8 of 19 new or added lines in 5 files covered. (42.11%)

4 existing lines in 2 files now uncovered.

11861 of 12418 relevant lines covered (95.51%)

0.96 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

33.33
/src/main/java/io/nats/client/support/NatsInetAddressProvider.java
1
// Copyright 2025 The NATS Authors
2
// Licensed under the Apache License, Version 2.0 (the "License");
3
// you may not use this file except in compliance with the License.
4
// You may obtain a copy of the License at:
5
//
6
// http://www.apache.org/licenses/LICENSE-2.0
7
//
8
// Unless required by applicable law or agreed to in writing, software
9
// distributed under the License is distributed on an "AS IS" BASIS,
10
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
// See the License for the specific language governing permissions and
12
// limitations under the License.
13

14
package io.nats.client.support;
15

16
import java.net.InetAddress;
17
import java.net.UnknownHostException;
18

19
public interface NatsInetAddressProvider {
20
    default InetAddress getByAddress(String host, byte[] addr) throws UnknownHostException {
NEW
21
        return InetAddress.getByAddress(host, addr);
×
22
    }
23

24
    default InetAddress getByName(String host) throws UnknownHostException {
25
        return InetAddress.getByName(host);
1✔
26
    }
27

28
    default InetAddress[] getAllByName(String host) throws UnknownHostException {
29
        return InetAddress.getAllByName(host);
1✔
30
    }
31

32
    default InetAddress getLoopbackAddress() {
NEW
33
        return InetAddress.getLoopbackAddress();
×
34
    }
35

36
    default InetAddress getByAddress(byte[] addr) throws UnknownHostException {
NEW
37
        return InetAddress.getByAddress(addr);
×
38
    }
39

40
    default InetAddress getLocalHost() throws UnknownHostException {
NEW
41
        return InetAddress.getLocalHost();
×
42
    }
43
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc